]>
Commit | Line | Data |
---|---|---|
23102ed6 | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
95259824 WB |
2 | From: Wolfgang Bumiller <w.bumiller@proxmox.com> |
3 | Date: Wed, 9 Dec 2015 14:17:38 +0100 | |
23102ed6 | 4 | Subject: [PATCH] vnc: altgr emulation |
95259824 WB |
5 | |
6 | --- | |
7 | ui/vnc.c | 26 +++++++++++++++++++++++++- | |
8 | 1 file changed, 25 insertions(+), 1 deletion(-) | |
9 | ||
10 | diff --git a/ui/vnc.c b/ui/vnc.c | |
6838f038 | 11 | index 06abe7360e..03f8f61b2e 100644 |
95259824 WB |
12 | --- a/ui/vnc.c |
13 | +++ b/ui/vnc.c | |
6838f038 | 14 | @@ -1775,6 +1775,10 @@ static void kbd_leds(void *opaque, int ledstate) |
95259824 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 */ | |
6838f038 | 25 | @@ -1855,8 +1859,27 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) |
95259824 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); | |
39 | + qemu_input_event_send_key_delay(vs->vd->key_delay_ms); | |
40 | + } | |
41 | + | |
42 | qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down); | |
43 | qemu_input_event_send_key_delay(vs->vd->key_delay_ms); | |
44 | + | |
45 | + if (emul_altgr) { | |
46 | + qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, false); | |
47 | + qemu_input_event_send_key_delay(vs->vd->key_delay_ms); | |
48 | + } | |
49 | + | |
50 | } else { | |
51 | bool numlock = vs->modifiers_state[0x45]; | |
52 | bool control = (vs->modifiers_state[0x1d] || | |
6838f038 | 53 | @@ -1996,7 +2019,8 @@ static void key_event(VncState *vs, int down, uint32_t sym) |
95259824 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 | -- | |
45169293 | 64 | 2.11.0 |
95259824 | 65 |