diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-03-08 11:53:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 11:53:46 +0100 |
commit | e0f6a22fddec3a451edbd08bf3424d7f38da2ae9 (patch) | |
tree | d441f09c2819c27e4c1d20c636d2c823759100de | |
parent | 86b0faf2ec3b76a09e898fcaa7dbfdd56189bed8 (diff) | |
parent | 3cc37342c46c0848c223a3a9e9ab8122a1bbc088 (diff) |
Merge pull request #58891 from bruvzg/x11_popup_crash
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 8 | ||||
-rw-r--r-- | platform/osx/display_server_osx.mm | 2 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 1ed4d8fb32..07cb6a23e8 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -2094,7 +2094,7 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo XGetWindowAttributes(x11_display, wd.x11_window, &xwa); ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup."); - ERR_FAIL_COND_MSG((xwa.map_state == IsViewable) && (wd.is_popup != p_enabled), "Pupup flag can't changed while window is opened."); + ERR_FAIL_COND_MSG((xwa.map_state == IsViewable) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened."); wd.is_popup = p_enabled; } break; default: { @@ -3660,10 +3660,14 @@ void DisplayServerX11::process_events() { const WindowData &wd = windows[window_id]; + XWindowAttributes xwa; + XSync(x11_display, False); + XGetWindowAttributes(x11_display, wd.x11_window, &xwa); + // Set focus when menu window is re-used. // RevertToPointerRoot is used to make sure we don't lose all focus in case // a subwindow and its parent are both destroyed. - if (!wd.no_focus && !wd.is_popup) { + if ((xwa.map_state == IsViewable) && !wd.no_focus && !wd.is_popup) { XSetInputFocus(x11_display, wd.x11_window, RevertToPointerRoot, CurrentTime); } diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index a4cd8f58bd..89ca6e50ec 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -1864,7 +1864,7 @@ void DisplayServerOSX::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo } break; case WINDOW_FLAG_POPUP: { ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup."); - ERR_FAIL_COND_MSG([wd.window_object isVisible] && (wd.is_popup != p_enabled), "Pupup flag can't changed while window is opened."); + ERR_FAIL_COND_MSG([wd.window_object isVisible] && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened."); wd.is_popup = p_enabled; } break; default: { diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 163f5c350b..27b4a2018f 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1238,7 +1238,7 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W } break; case WINDOW_FLAG_POPUP: { ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup."); - ERR_FAIL_COND_MSG(IsWindowVisible(wd.hWnd) && (wd.is_popup != p_enabled), "Pupup flag can't changed while window is opened."); + ERR_FAIL_COND_MSG(IsWindowVisible(wd.hWnd) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened."); wd.is_popup = p_enabled; } break; case WINDOW_FLAG_MAX: |