summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2020-08-22 17:50:06 +0200
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2020-08-26 18:14:36 +0200
commitbb306750ce8e0973229109be3536c6574cf960bd (patch)
treeee42480e6d9bc4b6130da5f8301e6a7e8daf4932
parent5315bff002fe3a7c4dadec6255446e9a2aaa0b16 (diff)
Fix WINDOW_EVENT_FOCUS_IN for popups on Windows
On Windows, WINDOW_EVENT_FOCUS_IN was never sent by the display server for popups, because WM_ACTIVATE events are received during the call to _update_window_style, which happened before the callbacks were set. This was causing some issues with the way Popup is now handling closing on parent focus. Now _update_window_style is only called during show_window, after Window initialized callbacks.
-rw-r--r--platform/windows/display_server_windows.cpp6
-rw-r--r--scene/main/window.cpp4
2 files changed, 6 insertions, 4 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index cf7bebfbdf..cd7f28833b 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -493,14 +493,16 @@ DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mod
wd.no_focus = true;
}
- _update_window_style(window_id);
-
return window_id;
}
void DisplayServerWindows::show_window(WindowID p_id) {
WindowData &wd = windows[p_id];
+ if (p_id != MAIN_WINDOW_ID) {
+ _update_window_style(p_id);
+ }
+
ShowWindow(wd.hWnd, wd.no_focus ? SW_SHOWNOACTIVATE : SW_SHOW); // Show The Window
if (!wd.no_focus) {
SetForegroundWindow(wd.hWnd); // Slightly Higher Priority
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index a5c5be8a44..7c2350d1c0 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -246,6 +246,8 @@ void Window::_make_window() {
}
}
+ _update_window_callbacks();
+
RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE);
DisplayServer::get_singleton()->show_window(window_id);
}
@@ -379,7 +381,6 @@ void Window::set_visible(bool p_visible) {
}
if (p_visible && window_id == DisplayServer::INVALID_WINDOW_ID) {
_make_window();
- _update_window_callbacks();
}
} else {
if (visible) {
@@ -738,7 +739,6 @@ void Window::_notification(int p_what) {
//create
if (visible) {
_make_window();
- _update_window_callbacks();
}
}
}