pve-qemu/debian/patches/pve/0015-vnc-altgr-emulation.patch

66 lines
2.0 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2017-04-05 11:49:19 +03:00
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
Date: Wed, 9 Dec 2015 14:17:38 +0100
Subject: [PATCH] vnc: altgr emulation
2017-04-05 11:49:19 +03:00
---
ui/vnc.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index 06abe7360e..03f8f61b2e 100644
2017-04-05 11:49:19 +03:00
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1775,6 +1775,10 @@ static void kbd_leds(void *opaque, int ledstate)
2017-04-05 11:49:19 +03:00
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 */
@@ -1855,8 +1859,27 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
2017-04-05 11:49:19 +03:00
}
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_delay(vs->vd->key_delay_ms);
+ }
+
qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down);
qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
+
+ if (emul_altgr) {
+ qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, false);
+ qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
+ }
+
} else {
bool numlock = vs->modifiers_state[0x45];
bool control = (vs->modifiers_state[0x1d] ||
@@ -1996,7 +2019,8 @@ static void key_event(VncState *vs, int down, uint32_t sym)
2017-04-05 11:49:19 +03:00
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);
}
--
2017-04-05 12:51:17 +03:00
2.11.0
2017-04-05 11:49:19 +03:00