diff options
author | Rui Matos <tiagomatos@gmail.com> | 2014-07-15 15:57:20 +0200 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2015-09-29 12:21:34 -0400 |
commit | 10e9116b3f709bec6d6a50446c1341441a0564e4 (patch) | |
tree | 6567ac9e23cc6fddd009af5937883fb3b70d59ff | |
parent | f937032ee6526af3c9206a2d8c6eacdeeb490d3b (diff) |
xwayland-input: Always set the xkb group index on modifiers events
While we have keyboard focus, the server's xkb code is already locking
and latching modifiers appropriately while processing keyboard
events.
Since there is no guaranteed order between wl_keyboard key and
modifiers events, if we got the modifiers event with a locked or
latched modifier and then process the key press event for that
modifier we would wrongly unlock/unlatch. To prevent this, we ignore
locked and latched modifiers while any of our surfaces has keyboard
focus.
But we always need to set the xkb group index since this might be
triggered programatically by the wayland compositor at any time.
Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r-- | hw/xwayland/xwayland-input.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 010d28c43..0515eb950 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -462,12 +462,6 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, xkbStateNotify sn; CARD16 changed; - /* We don't need any of this while we have keyboard focus since - the regular key event processing already takes care of setting - our internal state correctly. */ - if (xwl_seat->keyboard_focus) - return; - for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev != xwl_seat->keyboard && dev != GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD)) @@ -476,10 +470,12 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, old_state = dev->key->xkbInfo->state; new_state = &dev->key->xkbInfo->state; + if (!xwl_seat->keyboard_focus) { + new_state->locked_mods = mods_locked & XkbAllModifiersMask; + XkbLatchModifiers(dev, XkbAllModifiersMask, + mods_latched & XkbAllModifiersMask); + } new_state->locked_group = group & XkbAllGroupsMask; - new_state->locked_mods = mods_locked & XkbAllModifiersMask; - XkbLatchModifiers(dev, XkbAllModifiersMask, - mods_latched & XkbAllModifiersMask); XkbComputeDerivedState(dev->key->xkbInfo); |