]> git.proxmox.com Git - pve-qemu-kvm.git/blob - debian/patches/pve/0003-vnc-altgr-emulation.patch
adding 2.5 pve patches and left-over extra fixes
[pve-qemu-kvm.git] / debian / patches / pve / 0003-vnc-altgr-emulation.patch
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
5
6 ---
7 ui/vnc.c | 24 +++++++++++++++++++++++-
8 1 file changed, 23 insertions(+), 1 deletion(-)
9
10 diff --git a/ui/vnc.c b/ui/vnc.c
11 index cbe4d33..ae5a4fe 100644
12 --- a/ui/vnc.c
13 +++ b/ui/vnc.c
14 @@ -1797,6 +1797,10 @@ static void kbd_leds(void *opaque, int ledstate)
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 */
25 @@ -1877,7 +1881,24 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
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 + }
40 +
41 qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down);
42 +
43 + if (emul_altgr) {
44 + qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, false);
45 + }
46 +
47 } else {
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';
52 }
53
54 - keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF) & SCANCODE_KEYMASK;
55 + keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF);
56 +
57 trace_vnc_key_event_map(down, sym, keycode, code2name(keycode));
58 do_key_event(vs, down, keycode, sym);
59 }
60 --
61 2.1.4
62