summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2023-02-28 22:02:05 +0100
committerFlorian Müllner <fmuellner@gnome.org>2023-03-19 23:20:09 +0100
commit14a24886f6ca9359e3d020c32fc8fc4e91c87719 (patch)
tree14b9c8f7d875449358e02b1e8a69329daf8742ba
parent9ca231abb0d727babd3f2d9a32cab3cd0aa07c56 (diff)
downloadmutter-14a24886f6ca9359e3d020c32fc8fc4e91c87719.tar.gz
x11: Ignore _NET_ACTIVE_WINDOW client messages while grabbed
When a X11 application is started, typically what happens is: - A startup notification token is created, with a _TIME%d suffix - The application being spawned receives it through the environment - (dbus piping, maybe) - The application replies the startup notification token, and fetches the timestamp from it - The application makes a _NET_ACTIVE_WINDOW client message request with this timestamp - Mutter handles this client request and activates/focuses the window Prevent this last step if windows are not interactable (e.g. there is a compositor grab) and ignore the focus request. This specifically applies to X11 clients requesting focus themselves, and unlike previous approaches, doesn't try to prevent focus changes that do come through interaction with Mutter/GNOME Shell. This should only break if applications do not observe _NET_ACTIVE_WINDOW and perform XSetInputFocus on themselves, but in that case the X11 keyboard focus is stolen from our hands already. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2878> (cherry picked from commit 608d3019b6c8288fbfc7a916efcb8f55d5db040c)
-rw-r--r--src/x11/window-x11.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index 0c528c17a..74ee4bf7e 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -3379,7 +3379,8 @@ meta_window_x11_client_message (MetaWindow *window,
event->xclient.data.l[4]); /* height */
}
else if (event->xclient.message_type ==
- x11_display->atom__NET_ACTIVE_WINDOW)
+ x11_display->atom__NET_ACTIVE_WINDOW &&
+ meta_display_windows_are_interactable (window->display))
{
MetaClientType source_indication;
guint32 timestamp;