mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
keymap: consider modifier state when picking a mapping
Pass the modifier state to the keymap lookup function. In case multiple keysym -> keycode mappings exist look at the modifier state and prefer the mapping where the modifier state matches. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20180222070513.8740-6-kraxel@redhat.com
This commit is contained in:
parent
23ad24e48c
commit
abb4f2c965
5 changed files with 48 additions and 6 deletions
6
ui/sdl.c
6
ui/sdl.c
|
|
@ -201,6 +201,9 @@ static kbd_layout_t *kbd_layout = NULL;
|
|||
|
||||
static uint8_t sdl_keyevent_to_keycode_generic(const SDL_KeyboardEvent *ev)
|
||||
{
|
||||
bool shift = modifiers_state[0x2a] || modifiers_state[0x36];
|
||||
bool altgr = modifiers_state[0xb8];
|
||||
bool ctrl = modifiers_state[0x1d] || modifiers_state[0x9d];
|
||||
int keysym;
|
||||
/* workaround for X11+SDL bug with AltGR */
|
||||
keysym = ev->keysym.sym;
|
||||
|
|
@ -210,7 +213,8 @@ static uint8_t sdl_keyevent_to_keycode_generic(const SDL_KeyboardEvent *ev)
|
|||
if (keysym == 92 && ev->keysym.scancode == 133) {
|
||||
keysym = 0xa5;
|
||||
}
|
||||
return keysym2scancode(kbd_layout, keysym) & SCANCODE_KEYMASK;
|
||||
return keysym2scancode(kbd_layout, keysym,
|
||||
shift, altgr, ctrl) & SCANCODE_KEYMASK;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue