From e2079a7e56a54755b21e809c4f73dfdb67d28f45 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Wed, 15 Jan 2020 20:34:56 +0000 Subject: [PATCH] keyboard: Don't send repeated events to server This caused the virtual key to get "stuck" in the pressed position and then to stop working at all. It's definitely a bug on the server side also. --- src/keyboard.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/keyboard.c b/src/keyboard.c index d6a1c8f..5a3a664 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -34,6 +34,7 @@ struct table_entry { xkb_keysym_t symbol; xkb_keycode_t code; int level; + bool is_pressed; }; static void append_entry(struct keyboard* self, xkb_keysym_t symbol, @@ -263,6 +264,11 @@ void keyboard_feed(struct keyboard* self, xkb_keysym_t symbol, bool is_pressed) return; // TODO: Notify the user about this } + if (entry->is_pressed == is_pressed) + return; + + entry->is_pressed = is_pressed; + // TODO: This could cause some synchronisation problems with other // keyboards in the seat. keyboard_apply_mods(self, entry->code, is_pressed);