]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/pve/0003-vnc-altgr-emulation.patch
bump version to 2.9.0-1~rc2+5
[pve-qemu-kvm.git] / debian / patches / pve / 0003-vnc-altgr-emulation.patch
CommitLineData
1a91ab45 1From f3e33fe70da6f9361bd940d2b029d293a71408ca Mon Sep 17 00:00:00 2001
ca0fe5f5
WB
2From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3Date: Wed, 9 Dec 2015 14:17:38 +0100
adeb0c7a 4Subject: [PATCH 03/48] 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
10diff --git a/ui/vnc.c b/ui/vnc.c
1a91ab45 11index 821acdd..29575f8 100644
ca0fe5f5
WB
12--- a/ui/vnc.c
13+++ b/ui/vnc.c
1a91ab45 14@@ -1625,6 +1625,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 */
1a91ab45 25@@ -1705,8 +1709,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] ||
1a91ab45 53@@ -1846,7 +1869,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--
642.1.4
65