diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2018-03-21 14:50:37 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-04-09 10:40:47 +0200 |
commit | 34013c379340c5a1ebe0b9a5a63d6e157111d2ec (patch) | |
tree | ce633807c54478b10aea53f17ae07d68534a7ec1 /ui/sdl2-input.c | |
parent | da024b1ed2e756887bbed29b57dd634eb8a7ea5a (diff) | |
download | qemu-34013c379340c5a1ebe0b9a5a63d6e157111d2ec.zip qemu-34013c379340c5a1ebe0b9a5a63d6e157111d2ec.tar.gz qemu-34013c379340c5a1ebe0b9a5a63d6e157111d2ec.tar.bz2 |
sdl2: track kbd modifier state unconditionally
For both grapical and text consoles.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180321135041.15768-3-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/sdl2-input.c')
-rw-r--r-- | ui/sdl2-input.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c index 35d35c1..8d0d9ba 100644 --- a/ui/sdl2-input.c +++ b/ui/sdl2-input.c @@ -60,23 +60,7 @@ void sdl2_process_key(struct sdl2_console *scon, qcode = qemu_input_map_usb_to_qcode[ev->keysym.scancode]; - if (!qemu_console_is_graphic(con)) { - if (ev->type == SDL_KEYDOWN) { - switch (ev->keysym.scancode) { - case SDL_SCANCODE_RETURN: - kbd_put_keysym_console(con, '\n'); - break; - case SDL_SCANCODE_BACKSPACE: - kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE); - break; - default: - kbd_put_qcode_console(con, qcode, false); - break; - } - } - return; - } - + /* modifier state tracking */ switch (ev->keysym.scancode) { #if 0 case SDL_SCANCODE_NUMLOCKCLEAR: @@ -99,8 +83,27 @@ void sdl2_process_key(struct sdl2_console *scon, } else { modifiers_state[ev->keysym.scancode] = 1; } - /* fall though */ + break; default: + /* nothing */ + break; + } + + if (!qemu_console_is_graphic(con)) { + if (ev->type == SDL_KEYDOWN) { + switch (ev->keysym.scancode) { + case SDL_SCANCODE_RETURN: + kbd_put_keysym_console(con, '\n'); + break; + case SDL_SCANCODE_BACKSPACE: + kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE); + break; + default: + kbd_put_qcode_console(con, qcode, false); + break; + } + } + } else { qemu_input_event_send_key_qcode(con, qcode, ev->type == SDL_KEYDOWN); } |