summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerd Hoffmann2018-03-21 14:50:37 +0100
committerGerd Hoffmann2018-04-09 10:40:47 +0200
commit34013c379340c5a1ebe0b9a5a63d6e157111d2ec (patch)
treece633807c54478b10aea53f17ae07d68534a7ec1 /ui
parentui: add ctrl modifier support to kbd_put_qcode_console() (diff)
downloadqemu-34013c379340c5a1ebe0b9a5a63d6e157111d2ec.tar.gz
qemu-34013c379340c5a1ebe0b9a5a63d6e157111d2ec.tar.xz
qemu-34013c379340c5a1ebe0b9a5a63d6e157111d2ec.zip
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')
-rw-r--r--ui/sdl2-input.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
index 35d35c14c4..8d0d9ba17c 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);
}