uterm: input: fix stopping key-repeats on key-up
authorDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 11 Oct 2012 22:30:58 +0000 (00:30 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 11 Oct 2012 22:30:58 +0000 (00:30 +0200)
A key-repeat is about keycodes, not keysyms. We repeat the keycode and the
events that are generated by it, so we must also stop repeating if the
given keycode is released.

This fixes a bug where a key would still be repeated if we press:
<a-down> - <Shift-down> - <a-up> - <Shift-up>

Reported-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/uterm_input_uxkb.c

index d72bc07..77d3085 100644 (file)
@@ -214,10 +214,7 @@ int uxkb_dev_process(struct uterm_input_dev *dev,
        }
 
        if (key_state == KEY_RELEASED &&
-           dev->repeat_event.num_syms == num_keysyms &&
-           !memcmp(dev->repeat_event.keysyms,
-                   keysyms,
-                   sizeof(uint32_t) * num_keysyms)) {
+           dev->repeat_event.keycode == code) {
                ev_timer_update(dev->repeat_timer, NULL);
        } else if (key_state == KEY_PRESSED &&
                   xkb_key_repeats(keymap, keycode)) {