From 1d9ccdd6944871d2d4b3821fd416590d1b837ccd Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 15 Jun 2011 10:15:18 -0300 Subject: [RHEL6 qemu-kvm PATCH 1/3] vnc: fix numlock+capslock tracking RH-Author: Gerd Hoffmann Message-id: <1308132918-16503-1-git-send-email-kraxel@redhat.com> Patchwork-id: 27138 O-Subject: [RHEL-6.2 kvm PATCH] vnc: fix numlock+capslock tracking Bugzilla: 599306 RH-Acked-by: Markus Armbruster RH-Acked-by: Jes Sorensen RH-Acked-by: Luiz Capitulino This patch makes the numlock+capslock tracking logic only look at keydown events. Without this patch the vnc server will insert bogous capslock keypress in case it sees the following key sequence: shift down --- 'A' down --- shift up --- 'A' up ^ here It doesn't hurt with a PS/2 keyboard, but it disturbs the USB Keyboard. And with the key event queue just added to the usb keyboard the guest will actually notice. Signed-off-by: Gerd Hoffmann (cherry picked from commit 9892088b52da05c3944e84982922fa984e048044) Conflicts: vnc.c bugzilla: #599306 - Some strange behaviors on key's appearance viewed by using vnc --- vnc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Signed-off-by: Eduardo Habkost --- vnc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vnc.c b/vnc.c index 0f19af3..edcc448 100644 --- a/vnc.c +++ b/vnc.c @@ -1543,7 +1543,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) break; } - if (keycode_is_keypad(vs->vd->kbd_layout, keycode)) { + if (down && keycode_is_keypad(vs->vd->kbd_layout, keycode)) { /* If the numlock state needs to change then simulate an additional keypress before sending this one. This will happen if the user toggles numlock away from the VNC window. @@ -1561,7 +1561,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) } } - if ((sym >= 'A' && sym <= 'Z') || (sym >= 'a' && sym <= 'z')) { + if (down && ((sym >= 'A' && sym <= 'Z') || (sym >= 'a' && sym <= 'z'))) { /* If the capslock state needs to change then simulate an additional keypress before sending this one. This will happen if the user toggles capslock away from the VNC window. -- 1.7.3.2