Don't rely on the input driver to properly send button-up events for
every pressed key.

Signed-off-by: Jonas Ådahl <[email protected]>
---
 src/input.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/input.c b/src/input.c
index a186a4b..76b2698 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1988,6 +1988,29 @@ weston_seat_init_keyboard(struct weston_seat *seat, 
struct xkb_keymap *keymap)
        return 0;
 }
 
+static void
+weston_keyboard_reset_state(struct weston_keyboard *keyboard)
+{
+       struct weston_seat *seat = keyboard->seat;
+       struct xkb_state *state;
+
+#ifdef ENABLE_XKBCOMMON
+       if (seat->compositor->use_xkbcommon) {
+               state = xkb_state_new(keyboard->xkb_info->keymap);
+               if (!state) {
+                       weston_log("failed to reset XKB state\n");
+                       return;
+               }
+               xkb_state_unref(keyboard->xkb_state.state);
+               keyboard->xkb_state.state = state;
+
+               keyboard->xkb_state.leds = 0;
+       }
+#endif
+
+       seat->modifier_state = 0;
+}
+
 WL_EXPORT void
 weston_seat_release_keyboard(struct weston_seat *seat)
 {
@@ -1995,6 +2018,7 @@ weston_seat_release_keyboard(struct weston_seat *seat)
        if (seat->keyboard_device_count == 0) {
                weston_keyboard_set_focus(seat->keyboard, NULL);
                weston_keyboard_cancel_grab(seat->keyboard);
+               weston_keyboard_reset_state(seat->keyboard);
                seat_send_updated_caps(seat);
        }
 }
-- 
1.8.1.2

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to