From e26a6c36c881d2e39e1131dc91cb7bcbdc7cac3e Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Fri, 14 Jul 2023 09:16:06 +0300 Subject: [PATCH] Fix native popups auto-closing when interacting with non-client area. --- platform/linuxbsd/x11/display_server_x11.cpp | 2 +- platform/macos/display_server_macos.mm | 2 +- platform/windows/display_server_windows.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 2643cd3b1ad..27267866526 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -3957,7 +3957,7 @@ bool DisplayServerX11::mouse_process_popups() { // Find top popup to close. while (E) { // Popup window area. - Rect2i win_rect = Rect2i(window_get_position(E->get()), window_get_size(E->get())); + Rect2i win_rect = Rect2i(window_get_position_with_decorations(E->get()), window_get_size_with_decorations(E->get())); // Area of the parent window, which responsible for opening sub-menu. Rect2i safe_rect = window_get_popup_safe_rect(E->get()); if (win_rect.has_point(pos)) { diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index d64bb5211e5..de191827f58 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -4026,7 +4026,7 @@ bool DisplayServerMacOS::mouse_process_popups(bool p_close) { // Find top popup to close. while (E) { // Popup window area. - Rect2i win_rect = Rect2i(window_get_position(E->get()), window_get_size(E->get())); + Rect2i win_rect = Rect2i(window_get_position_with_decorations(E->get()), window_get_size_with_decorations(E->get())); // Area of the parent window, which responsible for opening sub-menu. Rect2i safe_rect = window_get_popup_safe_rect(E->get()); if (win_rect.has_point(pos)) { diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index b1dccdcefe7..15abf441f4a 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2735,7 +2735,7 @@ LRESULT DisplayServerWindows::MouseProc(int code, WPARAM wParam, LPARAM lParam) // Find top popup to close. while (E) { // Popup window area. - Rect2i win_rect = Rect2i(window_get_position(E->get()), window_get_size(E->get())); + Rect2i win_rect = Rect2i(window_get_position_with_decorations(E->get()), window_get_size_with_decorations(E->get())); // Area of the parent window, which responsible for opening sub-menu. Rect2i safe_rect = window_get_popup_safe_rect(E->get()); if (win_rect.has_point(pos)) {