From ba208df6e6629727f8702b85a5c025875cb41adb Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Sun, 27 Mar 2022 01:26:49 +0100 Subject: [PATCH] Send a focus-out notification when opening a Window Manager Popup --- scene/main/window.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 6837fcae213..62e8e7fea7d 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1101,6 +1101,14 @@ void Window::popup_centered_ratio(float p_ratio) { void Window::popup(const Rect2i &p_screen_rect) { emit_signal(SNAME("about_to_popup")); + if (!_get_embedder() && get_flag(FLAG_POPUP)) { + // Send a focus-out notification when opening a Window Manager Popup. + SceneTree *scene_tree = get_tree(); + if (scene_tree) { + scene_tree->notify_group("_viewports", NOTIFICATION_WM_WINDOW_FOCUS_OUT); + } + } + // Update window size to calculate the actual window size based on contents minimum size and minimum size. _update_window_size();