mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
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>
This commit is contained in:
parent
9d0706e44a
commit
44bb61c8d9
6 changed files with 149 additions and 94 deletions
25
vnc.c
25
vnc.c
|
@ -1482,9 +1482,9 @@ static void reset_keys(VncState *vs)
|
|||
int i;
|
||||
for(i = 0; i < 256; i++) {
|
||||
if (vs->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);
|
||||
vs->modifiers_state[i] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1492,8 +1492,13 @@ static void reset_keys(VncState *vs)
|
|||
|
||||
static void press_key(VncState *vs, int keysym)
|
||||
{
|
||||
kbd_put_keycode(keysym2scancode(vs->vd->kbd_layout, keysym) & 0x7f);
|
||||
kbd_put_keycode(keysym2scancode(vs->vd->kbd_layout, keysym) | 0x80);
|
||||
int keycode = keysym2scancode(vs->vd->kbd_layout, keysym) & SCANCODE_KEYMASK;
|
||||
if (keycode & SCANCODE_GREY)
|
||||
kbd_put_keycode(SCANCODE_EMUL0);
|
||||
kbd_put_keycode(keycode & SCANCODE_KEYCODEMASK);
|
||||
if (keycode & SCANCODE_GREY)
|
||||
kbd_put_keycode(SCANCODE_EMUL0);
|
||||
kbd_put_keycode(keycode | SCANCODE_UP);
|
||||
}
|
||||
|
||||
static void do_key_event(VncState *vs, int down, int keycode, int sym)
|
||||
|
@ -1566,12 +1571,12 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
|
|||
}
|
||||
|
||||
if (is_graphic_console()) {
|
||||
if (keycode & 0x80)
|
||||
kbd_put_keycode(0xe0);
|
||||
if (keycode & SCANCODE_GREY)
|
||||
kbd_put_keycode(SCANCODE_EMUL0);
|
||||
if (down)
|
||||
kbd_put_keycode(keycode & 0x7f);
|
||||
kbd_put_keycode(keycode & SCANCODE_KEYCODEMASK);
|
||||
else
|
||||
kbd_put_keycode(keycode | 0x80);
|
||||
kbd_put_keycode(keycode | SCANCODE_UP);
|
||||
} else {
|
||||
/* QEMU console emulation */
|
||||
if (down) {
|
||||
|
@ -1679,7 +1684,7 @@ static void key_event(VncState *vs, int down, uint32_t sym)
|
|||
lsym = lsym - 'A' + 'a';
|
||||
}
|
||||
|
||||
keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF);
|
||||
keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF) & SCANCODE_KEYMASK;
|
||||
do_key_event(vs, down, keycode, sym);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue