From 0553624ae34b36c7fba1b5cb75f253c681b547cd Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Mon, 3 Apr 2023 11:45:45 +0200 Subject: [PATCH] mutter: fix losing focus with xwayland windows open --- srcpkgs/mutter/patches/x11-focus.patch | 48 ++++++++++++++++++++++++++ srcpkgs/mutter/template | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/mutter/patches/x11-focus.patch diff --git a/srcpkgs/mutter/patches/x11-focus.patch b/srcpkgs/mutter/patches/x11-focus.patch new file mode 100644 index 00000000000..d7208572c90 --- /dev/null +++ b/srcpkgs/mutter/patches/x11-focus.patch @@ -0,0 +1,48 @@ +From 81c0cf0834e5b11ad8674accf5d143725c19d5ae Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Mon, 13 Feb 2023 20:12:38 +0100 +Subject: [PATCH] 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. + +Part-of: +--- + src/x11/events.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/x11/events.c b/src/x11/events.c +index fd0f84c4a2..89733ba33b 100644 +--- a/src/x11/events.c ++++ b/src/x11/events.c +@@ -1955,6 +1955,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)) + { +-- +GitLab + diff --git a/srcpkgs/mutter/template b/srcpkgs/mutter/template index 4705d3c72de..663d04e4386 100644 --- a/srcpkgs/mutter/template +++ b/srcpkgs/mutter/template @@ -1,7 +1,7 @@ # Template file for 'mutter' pkgname=mutter version=43.3 -revision=1 +revision=2 build_helper="gir" build_style=meson configure_args="-Degl_device=true -Dudev=true -Dnative_backend=true