keybindings: Avoid double calls to process_event() on the same event

If you first press a key that triggers the "special modifier key" paths
(ctrl, super), and then press another key that doesn't match (yet?) any
keybindings (eg. ctrl+alt, super+x), the second key press goes twice
through process_event(), once in the processing of this so far special
combination and another while we let the event through.

In order to keep things consistent, handle it differently depending on
whether we are a wayland compositor or not. For X11, consider the event
handled after the call to process_event() in process_special_modifier_key().
For Wayland, as XIAllowEvents is not the mechanism that allows clients see
the key event, we can just fall through the regular paths, without this
special handling.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1014
This commit is contained in:
Carlos Garnacho 2020-03-12 19:26:37 +01:00
parent 6989fea767
commit 67dd0b4fec

View File

@ -2037,6 +2037,13 @@ process_special_modifier_key (MetaDisplay *display,
{
*modifier_press_only = FALSE;
/* If this is a wayland session, we can avoid the shenanigans
* about passive grabs below, and let the event continue to
* be processed through the regular paths.
*/
if (!xdisplay)
return FALSE;
/* OK, the user hit modifier+key rather than pressing and
* releasing the modifier key alone. We want to handle the key
* sequence "normally". Unfortunately, using
@ -2069,8 +2076,6 @@ process_special_modifier_key (MetaDisplay *display,
XIAllowEvents (xdisplay,
clutter_input_device_get_device_id (event->device),
XIReplayDevice, event->time);
return FALSE;
}
}
else if (event->type == CLUTTER_KEY_RELEASE)