]> git.proxmox.com Git - pve-qemu-kvm.git/blobdiff - 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
diff --git a/debian/patches/pve/0003-vnc-altgr-emulation.patch b/debian/patches/pve/0003-vnc-altgr-emulation.patch
new file mode 100644 (file)
index 0000000..6d78360
--- /dev/null
@@ -0,0 +1,62 @@
+From 6a05de70fb7a5c34fdee915a0aa080a6bf76aba0 Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller@proxmox.com>
+Date: Wed, 9 Dec 2015 14:17:38 +0100
+Subject: [PATCH 03/41] vnc: altgr emulation
+
+---
+ ui/vnc.c | 24 +++++++++++++++++++++++-
+ 1 file changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/ui/vnc.c b/ui/vnc.c
+index cbe4d33..ae5a4fe 100644
+--- a/ui/vnc.c
++++ b/ui/vnc.c
+@@ -1797,6 +1797,10 @@ static void kbd_leds(void *opaque, int ledstate)
+ static void do_key_event(VncState *vs, int down, int keycode, int sym)
+ {
++    int mods =  keycode & 0xf00;
++
++    keycode &= SCANCODE_KEYMASK;
++
+     /* QEMU console switch */
+     switch(keycode) {
+     case 0x2a:                          /* Left Shift */
+@@ -1877,7 +1881,24 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
+     }
+     if (qemu_console_is_graphic(NULL)) {
++
++      /* our java vnc client never sends ALTGR, so we create
++         an artificial up/down event */
++
++      int emul_altgr = (mods & SCANCODE_ALTGR) &&
++          !vs->modifiers_state[0xb8];
++
++      if (emul_altgr) {
++            reset_keys(vs);
++            qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, true);
++      }
++
+         qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down);
++
++      if (emul_altgr) {
++             qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, false);
++      }
++
+     } else {
+         bool numlock = vs->modifiers_state[0x45];
+         bool control = (vs->modifiers_state[0x1d] ||
+@@ -2016,7 +2037,8 @@ static void key_event(VncState *vs, int down, uint32_t sym)
+         lsym = lsym - 'A' + 'a';
+     }
+-    keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF) & SCANCODE_KEYMASK;
++    keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF);
++
+     trace_vnc_key_event_map(down, sym, keycode, code2name(keycode));
+     do_key_event(vs, down, keycode, sym);
+ }
+-- 
+2.1.4
+