]>
Commit | Line | Data |
---|---|---|
9c3bec39 | 1 | From cf2ef62fc7d4ff7e64eed5a01e499c91b62121b9 Mon Sep 17 00:00:00 2001 |
ca0fe5f5 WB |
2 | From: Wolfgang Bumiller <w.bumiller@proxmox.com> |
3 | Date: Wed, 9 Dec 2015 14:17:38 +0100 | |
9c3bec39 | 4 | Subject: [PATCH 03/47] vnc: altgr emulation |
ca0fe5f5 WB |
5 | |
6 | --- | |
68a30562 WB |
7 | ui/vnc.c | 26 +++++++++++++++++++++++++- |
8 | 1 file changed, 25 insertions(+), 1 deletion(-) | |
ca0fe5f5 WB |
9 | |
10 | diff --git a/ui/vnc.c b/ui/vnc.c | |
9c3bec39 | 11 | index 76a3273..b9f36b5 100644 |
ca0fe5f5 WB |
12 | --- a/ui/vnc.c |
13 | +++ b/ui/vnc.c | |
9c3bec39 | 14 | @@ -1733,6 +1733,10 @@ static void kbd_leds(void *opaque, int ledstate) |
ca0fe5f5 WB |
15 | |
16 | static void do_key_event(VncState *vs, int down, int keycode, int sym) | |
17 | { | |
18 | + int mods = keycode & 0xf00; | |
19 | + | |
20 | + keycode &= SCANCODE_KEYMASK; | |
21 | + | |
22 | /* QEMU console switch */ | |
23 | switch(keycode) { | |
24 | case 0x2a: /* Left Shift */ | |
9c3bec39 | 25 | @@ -1813,8 +1817,27 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) |
ca0fe5f5 WB |
26 | } |
27 | ||
28 | if (qemu_console_is_graphic(NULL)) { | |
29 | + | |
30 | + /* our java vnc client never sends ALTGR, so we create | |
31 | + an artificial up/down event */ | |
32 | + | |
33 | + int emul_altgr = (mods & SCANCODE_ALTGR) && | |
34 | + !vs->modifiers_state[0xb8]; | |
35 | + | |
36 | + if (emul_altgr) { | |
37 | + reset_keys(vs); | |
38 | + qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, true); | |
68a30562 | 39 | + qemu_input_event_send_key_delay(vs->vd->key_delay_ms); |
ca0fe5f5 WB |
40 | + } |
41 | + | |
42 | qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down); | |
68a30562 | 43 | qemu_input_event_send_key_delay(vs->vd->key_delay_ms); |
ca0fe5f5 WB |
44 | + |
45 | + if (emul_altgr) { | |
46 | + qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, false); | |
68a30562 | 47 | + qemu_input_event_send_key_delay(vs->vd->key_delay_ms); |
ca0fe5f5 WB |
48 | + } |
49 | + | |
50 | } else { | |
51 | bool numlock = vs->modifiers_state[0x45]; | |
52 | bool control = (vs->modifiers_state[0x1d] || | |
9c3bec39 | 53 | @@ -1954,7 +1977,8 @@ static void key_event(VncState *vs, int down, uint32_t sym) |
ca0fe5f5 WB |
54 | lsym = lsym - 'A' + 'a'; |
55 | } | |
56 | ||
57 | - keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF) & SCANCODE_KEYMASK; | |
58 | + keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF); | |
59 | + | |
60 | trace_vnc_key_event_map(down, sym, keycode, code2name(keycode)); | |
61 | do_key_event(vs, down, keycode, sym); | |
62 | } | |
63 | -- | |
64 | 2.1.4 | |
65 |