Add a separate application focus/in notification out from Window focus notification.

This commit is contained in:
Juan Linietsky
2020-06-29 20:47:18 -03:00
parent 27605769c4
commit 438c380458
20 changed files with 65 additions and 35 deletions
+2 -2
View File
@@ -435,14 +435,14 @@ void EditorNode::_notification(int p_what) {
/* DO NOT LOAD SCENES HERE, WAIT FOR FILE SCANNING AND REIMPORT TO COMPLETE */
} break;
case NOTIFICATION_WM_FOCUS_IN: {
case NOTIFICATION_APPLICATION_FOCUS_IN: {
// Restore the original FPS cap after focusing back on the editor
OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(int(EDITOR_GET("interface/editor/low_processor_mode_sleep_usec")));
EditorFileSystem::get_singleton()->scan_changes();
} break;
case NOTIFICATION_WM_FOCUS_OUT: {
case NOTIFICATION_APPLICATION_FOCUS_OUT: {
// Set a low FPS cap to decrease CPU/GPU usage while the editor is unfocused
OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(int(EDITOR_GET("interface/editor/unfocused_low_processor_mode_sleep_usec")));
} break;
+1 -1
View File
@@ -39,7 +39,7 @@
#include "scene/gui/margin_container.h"
void EditorPluginSettings::_notification(int p_what) {
if (p_what == NOTIFICATION_WM_FOCUS_IN) {
if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) {
update_plugins();
} else if (p_what == Node::NOTIFICATION_READY) {
plugin_config_dialog->connect_compat("plugin_ready", EditorNode::get_singleton(), "_on_plugin_ready");
+2 -2
View File
@@ -182,8 +182,8 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
}
void EditorSpinSlider::_notification(int p_what) {
if (p_what == NOTIFICATION_WM_FOCUS_OUT ||
p_what == NOTIFICATION_WM_FOCUS_IN ||
if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_OUT ||
p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN ||
p_what == NOTIFICATION_EXIT_TREE) {
if (grabbing_spinner) {
grabber->hide();
+1 -1
View File
@@ -1337,7 +1337,7 @@ void ScriptEditor::_notification(int p_what) {
editor->disconnect("stop_pressed", callable_mp(this, &ScriptEditor::_editor_stop));
} break;
case NOTIFICATION_WM_FOCUS_IN: {
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
_test_script_times_on_disk();
_update_modified_scripts_for_external_editor();
} break;
+1 -1
View File
@@ -338,7 +338,7 @@ void ShaderEditor::_menu_option(int p_option) {
}
void ShaderEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_WM_FOCUS_IN) {
if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) {
_check_for_external_edit();
}
}
+1 -1
View File
@@ -200,7 +200,7 @@ void ShaderFileEditor::_update_options() {
}
void ShaderFileEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_WM_FOCUS_IN) {
if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) {
if (is_visible_in_tree() && shader_file.is_valid()) {
_update_options();
}
@@ -780,7 +780,7 @@ void TextureRegionEditor::_notification(int p_what) {
_update_autoslice();
}
} break;
case NOTIFICATION_WM_FOCUS_IN: {
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
// This happens when the user leaves the Editor and returns,
// they could have changed the textures, so the cache is cleared.
cache_map.clear();