summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-30 16:58:46 +0200
committerGitHub <noreply@github.com>2020-06-30 16:58:46 +0200
commit5f2295f2dfdbf1ac4e63b562e4cef71f2fda4036 (patch)
treee55f07e3c6ae4a1986bba3d53e979c4d1414576b /scene/main
parentf3c5f12e3965b0a3147a9264f5ac42599abca672 (diff)
parent438c380458ee284d44f0561f86c2468ec11adc3b (diff)
Merge pull request #39986 from reduz/app-inout-notification
Add a separate application focus/in notification
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp10
-rw-r--r--scene/main/node.h10
-rw-r--r--scene/main/scene_tree.cpp8
-rw-r--r--scene/main/viewport.cpp2
-rw-r--r--scene/main/window.cpp4
5 files changed, 20 insertions, 14 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 1bf828a03b..88f9730f78 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2857,8 +2857,8 @@ void Node::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER);
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_EXIT);
- BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN);
- BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT);
+ BIND_CONSTANT(NOTIFICATION_WM_WINDOW_FOCUS_IN);
+ BIND_CONSTANT(NOTIFICATION_WM_WINDOW_FOCUS_OUT);
BIND_CONSTANT(NOTIFICATION_WM_CLOSE_REQUEST);
BIND_CONSTANT(NOTIFICATION_WM_GO_BACK_REQUEST);
BIND_CONSTANT(NOTIFICATION_WM_SIZE_CHANGED);
@@ -2867,8 +2867,10 @@ void Node::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_WM_ABOUT);
BIND_CONSTANT(NOTIFICATION_CRASH);
BIND_CONSTANT(NOTIFICATION_OS_IME_UPDATE);
- BIND_CONSTANT(NOTIFICATION_APP_RESUMED);
- BIND_CONSTANT(NOTIFICATION_APP_PAUSED);
+ BIND_CONSTANT(NOTIFICATION_APPLICATION_RESUMED);
+ BIND_CONSTANT(NOTIFICATION_APPLICATION_PAUSED);
+ BIND_CONSTANT(NOTIFICATION_APPLICATION_FOCUS_IN);
+ BIND_CONSTANT(NOTIFICATION_APPLICATION_FOCUS_OUT);
BIND_ENUM_CONSTANT(PAUSE_MODE_INHERIT);
BIND_ENUM_CONSTANT(PAUSE_MODE_STOP);
diff --git a/scene/main/node.h b/scene/main/node.h
index 7595aabd9a..c3972e2d8e 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -243,8 +243,8 @@ public:
NOTIFICATION_WM_MOUSE_ENTER = 1002,
NOTIFICATION_WM_MOUSE_EXIT = 1003,
- NOTIFICATION_WM_FOCUS_IN = 1004,
- NOTIFICATION_WM_FOCUS_OUT = 1005,
+ NOTIFICATION_WM_WINDOW_FOCUS_IN = 1004,
+ NOTIFICATION_WM_WINDOW_FOCUS_OUT = 1005,
NOTIFICATION_WM_CLOSE_REQUEST = 1006,
NOTIFICATION_WM_GO_BACK_REQUEST = 1007,
NOTIFICATION_WM_SIZE_CHANGED = 1008,
@@ -255,8 +255,10 @@ public:
NOTIFICATION_WM_ABOUT = MainLoop::NOTIFICATION_WM_ABOUT,
NOTIFICATION_CRASH = MainLoop::NOTIFICATION_CRASH,
NOTIFICATION_OS_IME_UPDATE = MainLoop::NOTIFICATION_OS_IME_UPDATE,
- NOTIFICATION_APP_RESUMED = MainLoop::NOTIFICATION_APP_RESUMED,
- NOTIFICATION_APP_PAUSED = MainLoop::NOTIFICATION_APP_PAUSED
+ NOTIFICATION_APPLICATION_RESUMED = MainLoop::NOTIFICATION_APPLICATION_RESUMED,
+ NOTIFICATION_APPLICATION_PAUSED = MainLoop::NOTIFICATION_APPLICATION_PAUSED,
+ NOTIFICATION_APPLICATION_FOCUS_IN = MainLoop::NOTIFICATION_APPLICATION_FOCUS_IN,
+ NOTIFICATION_APPLICATION_FOCUS_OUT = MainLoop::NOTIFICATION_APPLICATION_FOCUS_OUT
};
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 3c3c7533a3..a418883506 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -587,9 +587,11 @@ void SceneTree::_notification(int p_notification) {
case NOTIFICATION_OS_IME_UPDATE:
case NOTIFICATION_WM_ABOUT:
case NOTIFICATION_CRASH:
- case NOTIFICATION_APP_RESUMED:
- case NOTIFICATION_APP_PAUSED: {
- get_root()->propagate_notification(p_notification);
+ case NOTIFICATION_APPLICATION_RESUMED:
+ case NOTIFICATION_APPLICATION_PAUSED:
+ case NOTIFICATION_APPLICATION_FOCUS_IN:
+ case NOTIFICATION_APPLICATION_FOCUS_OUT: {
+ get_root()->propagate_notification(p_notification); //pass these to nodes, since they are mirrored
} break;
default:
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 606f39370b..8042f02fa6 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -815,7 +815,7 @@ void Viewport::_notification(int p_what) {
} break;
case NOTIFICATION_WM_MOUSE_EXIT:
- case NOTIFICATION_WM_FOCUS_OUT: {
+ case NOTIFICATION_WM_WINDOW_FOCUS_OUT: {
_drop_physics_mouseover();
if (gui.mouse_focus && !gui.forced_mouse_focus) {
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index a9be8a1eff..da02f932f1 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -316,13 +316,13 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) {
} break;
case DisplayServer::WINDOW_EVENT_FOCUS_IN: {
focused = true;
- _propagate_window_notification(this, NOTIFICATION_WM_FOCUS_IN);
+ _propagate_window_notification(this, NOTIFICATION_WM_WINDOW_FOCUS_IN);
emit_signal("focus_entered");
} break;
case DisplayServer::WINDOW_EVENT_FOCUS_OUT: {
focused = false;
- _propagate_window_notification(this, NOTIFICATION_WM_FOCUS_OUT);
+ _propagate_window_notification(this, NOTIFICATION_WM_WINDOW_FOCUS_OUT);
emit_signal("focus_exited");
} break;
case DisplayServer::WINDOW_EVENT_CLOSE_REQUEST: {