1 From 6a05de70fb7a5c34fdee915a0aa080a6bf76aba0 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Wed, 9 Dec 2015 14:17:38 +0100
4 Subject: [PATCH 03/41] vnc: altgr emulation
7 ui/vnc.c | 24 +++++++++++++++++++++++-
8 1 file changed, 23 insertions(+), 1 deletion(-)
10 diff --git a/ui/vnc.c b/ui/vnc.c
11 index cbe4d33..ae5a4fe 100644
14 @@ -1797,6 +1797,10 @@ static void kbd_leds(void *opaque, int ledstate)
16 static void do_key_event(VncState *vs, int down, int keycode, int sym)
18 + int mods = keycode & 0xf00;
20 + keycode &= SCANCODE_KEYMASK;
22 /* QEMU console switch */
24 case 0x2a: /* Left Shift */
25 @@ -1877,7 +1881,24 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
28 if (qemu_console_is_graphic(NULL)) {
30 + /* our java vnc client never sends ALTGR, so we create
31 + an artificial up/down event */
33 + int emul_altgr = (mods & SCANCODE_ALTGR) &&
34 + !vs->modifiers_state[0xb8];
38 + qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, true);
41 qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down);
44 + qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, false);
48 bool numlock = vs->modifiers_state[0x45];
49 bool control = (vs->modifiers_state[0x1d] ||
50 @@ -2016,7 +2037,8 @@ static void key_event(VncState *vs, int down, uint32_t sym)
51 lsym = lsym - 'A' + 'a';
54 - keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF) & SCANCODE_KEYMASK;
55 + keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF);
57 trace_vnc_key_event_map(down, sym, keycode, code2name(keycode));
58 do_key_event(vs, down, keycode, sym);