summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2023-02-13 20:12:38 +0100
committerJonas Ã…dahl <jadahl@gmail.com>2023-02-16 04:03:02 -0500
commit12ce58dba4f96f6a948c1d166646d263253e3ee0 (patch)
tree54b48ad663876e6e5e602f6cfa63813d171be38f
parenta8a348185b2237443c8125f9d19ef59507640160 (diff)
downloadmutter-12ce58dba4f96f6a948c1d166646d263253e3ee0.tar.gz
x11: Avoid updating focus on wayland compositor
Reading upon the history of this code branch (commits 6891ce95dce and 7a4c808e43d4 are most relevant), it seems this code is meant to synchronize Mutter focus state taking the Xserver state as true. That is, if Mutter tried to change the focus but something truncated that action, Mutter focus will be changed to be in sync with the Xserver again. This sounds backwards in a Wayland session. Mutter focus should be the canonical source, and not second-guessed from the current Xserver focus window. These race conditions might still apply between X11 clients, so make these paths only apply in that case. An example of this breaking can be reproduced with a Spotify and Firefox window, moving the focus from the first to the second by going to the GNOME Shell overview in between, and clicking the Firefox window from there. The Firefox window will be raised, but refuse to take focus. It's unclear what made this an issue recently, perhaps commit 0e6395d9328 since the now possibly ignored XI_FocusIn/Out events affect this accounting of the Xserver focused window. Anyhow it sounds better to ignore these paths for Wayland/native altogether. (cherry picked from commit 81c0cf0834e5b11ad8674accf5d143725c19d5ae) Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2848>
-rw-r--r--src/x11/events.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/x11/events.c b/src/x11/events.c
index 8b9c10825..cc7f21423 100644
--- a/src/x11/events.c
+++ b/src/x11/events.c
@@ -1932,6 +1932,7 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
if (x11_display->focused_by_us &&
event->xany.serial > x11_display->focus_serial &&
display->focus_window &&
+ display->focus_window->client_type == META_WINDOW_CLIENT_TYPE_X11 &&
!window_has_xwindow (display->focus_window, x11_display->server_focus_window) &&
meta_display_windows_are_interactable (display))
{