qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chunyan Liu <cyliu@suse.com>
To: qemu-devel@nongnu.org
Cc: stefano.stabellini@eu.citrix.com, Chunyan Liu <cyliu@suse.com>,
	xen-devel@lists.xen.org
Subject: [Qemu-devel] [PATCH] vnc: add additional key up event before repeated key down
Date: Fri,  5 Sep 2014 11:14:23 +0800	[thread overview]
Message-ID: <1409886863-6124-1-git-send-email-cyliu@suse.com> (raw)

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).

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
index f8d9b7d..a265378 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1659,6 +1659,25 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
         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
-- 
1.8.4.5

             reply	other threads:[~2014-09-05  3:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05  3:14 Chunyan Liu [this message]
2014-09-05 21:23 ` [Qemu-devel] [PATCH] vnc: add additional key up event before repeated key down Stefano Stabellini
2014-09-09  3:34   ` Chun Yan Liu
2014-09-09 18:23     ` Markus Armbruster
2014-09-10  3:31       ` Chun Yan Liu
2014-09-10  3:47         ` Anthony Liguori
2014-09-10  5:36           ` Chun Yan Liu
2014-09-17  7:04           ` Markus Armbruster
2014-09-17  7:43             ` Peter Maydell
2014-09-17  9:25               ` Markus Armbruster
2014-09-17 11:24               ` Gerd Hoffmann
2014-09-17 16:08                 ` Peter Maydell
2014-09-18  6:01                   ` [Qemu-devel] 答复: " Li, Guang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409886863-6124-1-git-send-email-cyliu@suse.com \
    --to=cyliu@suse.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).