aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
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);
}