2017-10-04 00:19:51 +02:00
|
|
|
From d609e5c88bf83530538ac63c74789f9d47cfb4b3 Mon Sep 17 00:00:00 2001
|
2017-03-15 20:38:55 +01:00
|
|
|
From: Chunyan Liu <cyliu@suse.com>
|
|
|
|
Date: Thu, 3 Mar 2016 16:48:17 +0800
|
|
|
|
Subject: [PATCH] Fix tigervnc long press issue
|
|
|
|
|
|
|
|
Using xen tools 'xl vncviewer' with tigervnc (default on SLE-12),
|
|
|
|
found that: the display of the guest is unexpected while keep
|
|
|
|
pressing a key. We expect the same character multiple times, but
|
|
|
|
it prints only one time. This happens on a PV guest in text mode.
|
|
|
|
|
|
|
|
After debugging, found that tigervnc sends repeated key down events
|
|
|
|
in this case, to differentiate from user pressing the same key many
|
|
|
|
times. Vnc server only prints the character when it finally receives
|
|
|
|
key up event.
|
|
|
|
|
|
|
|
To solve this issue, this patch tries to add additional key up event
|
|
|
|
before the next repeated key down event (if the key is not a control
|
|
|
|
key).
|
|
|
|
|
|
|
|
[CYL: BSC#882405]
|
|
|
|
Signed-off-by: Chunyan Liu <cyliu@suse.com>
|
|
|
|
---
|
|
|
|
ui/vnc.c | 19 +++++++++++++++++++
|
|
|
|
1 file changed, 19 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/ui/vnc.c b/ui/vnc.c
|
2017-08-31 00:22:50 +02:00
|
|
|
index 651cbb8606..eb3d7d0e54 100644
|
2017-03-15 20:38:55 +01:00
|
|
|
--- a/ui/vnc.c
|
|
|
|
+++ b/ui/vnc.c
|
2017-08-31 00:22:50 +02:00
|
|
|
@@ -1657,6 +1657,25 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
|
2017-03-15 20:38:55 +01:00
|
|
|
if (down)
|
|
|
|
vs->modifiers_state[keycode] ^= 1;
|
|
|
|
break;
|
|
|
|
+ default:
|
|
|
|
+ if (qemu_console_is_graphic(NULL)) {
|
|
|
|
+ /* record key 'down' info. Some client like tigervnc
|
|
|
|
+ * will send key down repeatedly if user pressing a
|
|
|
|
+ * a key for long time. In this case, we should add
|
|
|
|
+ * additional key up event before repeated key down,
|
|
|
|
+ * so that it can display the key multiple times.
|
|
|
|
+ */
|
|
|
|
+ if (down) {
|
|
|
|
+ if (vs->modifiers_state[keycode]) {
|
|
|
|
+ /* add a key up event */
|
|
|
|
+ do_key_event(vs, 0, keycode, sym);
|
|
|
|
+ }
|
|
|
|
+ vs->modifiers_state[keycode] = 1;
|
|
|
|
+ } else {
|
|
|
|
+ vs->modifiers_state[keycode] = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Turn off the lock state sync logic if the client support the led
|