From 02c6d985b86803ba40b5819aef04933e3ec8fb26 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. (cherry picked from commit e26a6c36c881d2e39e1131dc91cb7bcbdc7cac3e) --- 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 648d127f38d..072f014911d 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -3928,7 +3928,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 3e5348149c1..fcc2db7b05e 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -3800,7 +3800,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 e58eefd1ce8..bbaa8784fbf 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2503,7 +2503,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)) {