From 040de396b2ac2ea36de91a1173e84e44421efff3 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 24 Jun 2019 18:11:22 +0200 Subject: [PATCH] window: Don't use button grab modifiers with inhibit shortcuts On Wayland, if a client issues a inhibit-shortcut request, the Wayland compositor will disable its own shortcuts. We should also disable the default handler for the button grab modifier so that button events with the window grab modifiers pressed are not caught by the compositor but are forwarded to the client surface. That also fixes the same issue with Xwayland applications issuing grabs, as those end up being emulated like shortcut inhibition. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/642 --- src/core/window.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/window.c b/src/core/window.c index 121478331..185c92534 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -8267,7 +8267,9 @@ meta_window_handle_ungrabbed_event (MetaWindow *window, MetaDisplay *display = window->display; gboolean unmodified; gboolean is_window_grab; + gboolean is_window_button_grab_allowed; ClutterModifierType grab_mods, event_mods; + ClutterInputDevice *source; gfloat x, y; guint button; @@ -8339,7 +8341,11 @@ meta_window_handle_ungrabbed_event (MetaWindow *window, grab_mods = meta_display_get_window_grab_modifiers (display); event_mods = clutter_event_get_state (event); unmodified = (event_mods & grab_mods) == 0; - is_window_grab = (event_mods & grab_mods) == grab_mods; + source = clutter_event_get_source_device (event); + is_window_button_grab_allowed = + !meta_window_shortcuts_inhibited (display->focus_window, source); + is_window_grab = (is_window_button_grab_allowed && + ((event_mods & grab_mods) == grab_mods)); clutter_event_get_coords (event, &x, &y);