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>
This commit is contained in:
Gerd Hoffmann 2018-03-21 14:50:37 +01:00
parent da024b1ed2
commit 34013c3793

View File

@ -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);
}