summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd/x11/display_server_x11.cpp
diff options
context:
space:
mode:
authorDalton Lang <35282898+GrammAcc@users.noreply.github.com>2023-12-12 18:47:42 -0600
committerDalton Lang <35282898+GrammAcc@users.noreply.github.com>2024-02-05 17:00:24 -0600
commit8a2e4409e63be2cf460b5931df2f80cc998a590a (patch)
tree831f0b8740b44a72181d437fd51d66ce5408f8c6 /platform/linuxbsd/x11/display_server_x11.cpp
parentd3352813ea44447bfbf135efdec23acc4d1d3f89 (diff)
downloadredot-engine-8a2e4409e63be2cf460b5931df2f80cc998a590a.tar.gz
[X11] Partial Fix Godot Editor and Project Manager steals focus on a window manager on Linux
This is a workaround for the most critical portion of the WM focus bug described in #68305. On some specific X11 WM configurations, the editor's main window and any popups it creates will fight for focus, which causes a total system lockup due to mouse and keyboard input being stolen as well. Getting out of this infinite loop requires force restarting the system. It can be tested with the following shell script: ```bash !#/bin/sh godot4 & sleep 30 pkill -x godot4 ``` The workaround identified in #68305 is to remove the call to XSetInputFocus in the ConfigureNotify event handler, so I have removed the conditional block that calls this as well as the setup code above it since there is no need to allocate the memory for the variables if they won't be used in that call anymore. This is just a hack and is not a complete fix for #68305. Multiple developers are collaborating on a proper fix in the discussion in that issue, but time is a valuable resource that no one has enough of, so I am committing this workaround as a stop-gap to prevent the most critical problem while we work on a full solution for the underlying cause.
Diffstat (limited to 'platform/linuxbsd/x11/display_server_x11.cpp')
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp13
1 files changed, 0 insertions, 13 deletions
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index 20e2e897f2..b147e43445 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -4718,19 +4718,6 @@ void DisplayServerX11::process_events() {
break;
}
- 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 ((xwa.map_state == IsViewable) && !wd.no_focus && !wd.is_popup && _window_focus_check()) {
- _set_input_focus(wd.x11_window, RevertToPointerRoot);
- }
-
_window_changed(&event);
} break;