mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-25 02:52:06 -06:00
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:
parent
da024b1ed2
commit
34013c3793
1 changed files with 21 additions and 18 deletions
|
@ -60,23 +60,7 @@ void sdl2_process_key(struct sdl2_console *scon,
|
||||||
|
|
||||||
qcode = qemu_input_map_usb_to_qcode[ev->keysym.scancode];
|
qcode = qemu_input_map_usb_to_qcode[ev->keysym.scancode];
|
||||||
|
|
||||||
if (!qemu_console_is_graphic(con)) {
|
/* modifier state tracking */
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (ev->keysym.scancode) {
|
switch (ev->keysym.scancode) {
|
||||||
#if 0
|
#if 0
|
||||||
case SDL_SCANCODE_NUMLOCKCLEAR:
|
case SDL_SCANCODE_NUMLOCKCLEAR:
|
||||||
|
@ -99,8 +83,27 @@ void sdl2_process_key(struct sdl2_console *scon,
|
||||||
} else {
|
} else {
|
||||||
modifiers_state[ev->keysym.scancode] = 1;
|
modifiers_state[ev->keysym.scancode] = 1;
|
||||||
}
|
}
|
||||||
/* fall though */
|
break;
|
||||||
default:
|
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,
|
qemu_input_event_send_key_qcode(con, qcode,
|
||||||
ev->type == SDL_KEYDOWN);
|
ev->type == SDL_KEYDOWN);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue