Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

X11: Return focus to parent popup when closing a nested popup with active IME

dualfrozcc031db0f063
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index 962c57d2975..ed1138b4215 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -2487,6 +2487,9 @@ void DisplayServerX11::window_set_transient(DisplayServerEnums::WindowID p_windo
if ((xwa.map_state == IsViewable) && !wd_parent.no_focus && !wd_window.is_popup && _window_focus_check()) {
_set_input_focus(wd_parent.x11_window, RevertToPointerRoot);
}
+ } else if (wd_window.focused && wd_window.ime_active && wd_parent.is_popup && (xwa.map_state == IsViewable)) {
+ // Popups are not managed by the window manager, so focus taken by the IME window of a nested popup (e.g. its search bar) has to be returned to the parent popup manually.
+ _set_input_focus(wd_parent.x11_window, RevertToPointerRoot);
}
} else {
ERR_FAIL_COND(!windows.has(p_parent));