diff options
author | Samuel Thibault <samuel.thibault@gnu.org> | 2010-02-28 21:03:00 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2010-03-06 23:15:30 +0100 |
commit | 44bb61c8d9ad5fa0045465933b1ac8f2b1b98762 (patch) | |
tree | 34784bea640f307a4dd6c1e4bedf86cc937b97f3 /sdl.c | |
parent | 9d0706e44a14701e8449214c4a62a5a1ca370025 (diff) | |
download | qemu-44bb61c8d9ad5fa0045465933b1ac8f2b1b98762.tar.gz qemu-44bb61c8d9ad5fa0045465933b1ac8f2b1b98762.tar.bz2 qemu-44bb61c8d9ad5fa0045465933b1ac8f2b1b98762.zip |
Fix curses interaction with keymaps
The combination of keymap support (-k option) and curses is currently
very broken. The patch below fixes it by first extending keymap support
to interpret the shift, ctrl, altgr and addupper keywords in keymaps,
and to fix curses into properly using keymaps.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'sdl.c')
-rw-r--r-- | sdl.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -248,7 +248,7 @@ 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); + return keysym2scancode(kbd_layout, keysym) & SCANCODE_KEYMASK; } /* specific keyboard conversions from scan codes */ @@ -343,9 +343,9 @@ static void reset_keys(void) int i; for(i = 0; i < 256; i++) { if (modifiers_state[i]) { - if (i & 0x80) - kbd_put_keycode(0xe0); - kbd_put_keycode(i | 0x80); + if (i & SCANCODE_GREY) + kbd_put_keycode(SCANCODE_EMUL0); + kbd_put_keycode(i | SCANCODE_UP); modifiers_state[i] = 0; } } @@ -359,7 +359,7 @@ static void sdl_process_key(SDL_KeyboardEvent *ev) /* specific case */ v = 0; if (ev->type == SDL_KEYUP) - v |= 0x80; + v |= SCANCODE_UP; kbd_put_keycode(0xe1); kbd_put_keycode(0x1d | v); kbd_put_keycode(0x45 | v); @@ -392,17 +392,17 @@ static void sdl_process_key(SDL_KeyboardEvent *ev) case 0x3a: /* caps lock */ /* SDL does not send the key up event, so we generate it */ kbd_put_keycode(keycode); - kbd_put_keycode(keycode | 0x80); + kbd_put_keycode(keycode | SCANCODE_UP); return; } /* now send the key code */ - if (keycode & 0x80) - kbd_put_keycode(0xe0); + if (keycode & SCANCODE_GREY) + kbd_put_keycode(SCANCODE_EMUL0); if (ev->type == SDL_KEYUP) - kbd_put_keycode(keycode | 0x80); + kbd_put_keycode(keycode | SCANCODE_UP); else - kbd_put_keycode(keycode & 0x7f); + kbd_put_keycode(keycode & SCANCODE_KEYCODEMASK); } static void sdl_update_caption(void) |