wayland-keyboard: Notify clients of pending modifier state changes

If we get a key event but still have pending modifier state changes we
need to send a modifiers event right away so that the key event can be
interpreted by clients correctly modified.

This case could happen when mutter/gnome-shell itself consumes the
modifier key press event such as with the overview key which by
default is triggered on super press.

https://bugzilla.gnome.org/show_bug.cgi?id=748526
This commit is contained in:
Rui Matos 2015-11-03 17:58:16 +01:00
parent 0fa9751b31
commit e284370013

View File

@ -555,6 +555,13 @@ meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
{ {
gboolean is_press = event->type == CLUTTER_KEY_PRESS; gboolean is_press = event->type == CLUTTER_KEY_PRESS;
/* If we get a key event but still have pending modifier state
* changes from a previous event that didn't get cleared, we need to
* send that state right away so that the new key event can be
* interpreted by clients correctly modified. */
if (keyboard->mods_changed)
notify_modifiers (keyboard);
keyboard->mods_changed = xkb_state_update_key (keyboard->xkb_info.state, keyboard->mods_changed = xkb_state_update_key (keyboard->xkb_info.state,
event->hardware_keycode, event->hardware_keycode,
is_press ? XKB_KEY_DOWN : XKB_KEY_UP); is_press ? XKB_KEY_DOWN : XKB_KEY_UP);