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
This commit is contained in:
Olivier Fourdan 2019-06-24 18:11:22 +02:00
parent 5a4bc15d0b
commit 040de396b2

View File

@ -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);