summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/input.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/ui/input.c b/ui/input.c
index 9abef0cd78..ecfeb43824 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -234,13 +234,11 @@ static void free_keycodes(void)
static void release_keys(void *opaque)
{
- int i;
-
- for (i = 0; i < keycodes_size; i++) {
- if (keycodes[i] & 0x80) {
+ while (keycodes_size > 0) {
+ if (keycodes[--keycodes_size] & 0x80) {
kbd_put_keycode(0xe0);
}
- kbd_put_keycode(keycodes[i]| 0x80);
+ kbd_put_keycode(keycodes[keycodes_size] | 0x80);
}
free_keycodes();