Skip to content

Commit

Permalink
kbd-state: fix autorepeat handling
Browse files Browse the repository at this point in the history
When allowing multiple down-events in a row (key autorepeat) we can't
use change_bit() any more to update the state, because autorepeat events
don't change the key state.  We have to explicitly use set_bit() and
clear_bit() instead.

Cc: qemu-stable@nongnu.org
Fixes: 3592186 kbd-state: don't block auto-repeat events
Buglink: https://bugs.launchpad.net/qemu/+bug/1828272
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20190514042443.10735-1-kraxel@redhat.com
(cherry picked from commit 5fff13f)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
kraxel authored and mdroth committed Sep 17, 2019
1 parent ffabb55 commit a68ab7c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ui/kbd-state.c
Expand Up @@ -59,7 +59,11 @@ void qkbd_state_key_event(QKbdState *kbd, QKeyCode qcode, bool down)
}

/* update key and modifier state */
change_bit(qcode, kbd->keys);
if (down) {
set_bit(qcode, kbd->keys);
} else {
clear_bit(qcode, kbd->keys);
}
switch (qcode) {
case Q_KEY_CODE_SHIFT:
case Q_KEY_CODE_SHIFT_R:
Expand Down

0 comments on commit a68ab7c

Please sign in to comment.