From patchwork Fri Jan 14 11:55:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 78883 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1B039B7088 for ; Fri, 14 Jan 2011 22:56:57 +1100 (EST) Received: from localhost ([127.0.0.1]:39235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdiGz-0001WE-Pg for incoming@patchwork.ozlabs.org; Fri, 14 Jan 2011 06:56:53 -0500 Received: from [140.186.70.92] (port=55577 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdiFm-0001UG-7f for qemu-devel@nongnu.org; Fri, 14 Jan 2011 06:55:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PdiFl-0005Hx-2I for qemu-devel@nongnu.org; Fri, 14 Jan 2011 06:55:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PdiFk-0005Hl-Rr for qemu-devel@nongnu.org; Fri, 14 Jan 2011 06:55:37 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0EBtZkR012441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 14 Jan 2011 06:55:36 -0500 Received: from rincewind.home.kraxel.org (vpn1-4-212.ams2.redhat.com [10.36.4.212]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0EBtXOV006065; Fri, 14 Jan 2011 06:55:34 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id B76A041472; Fri, 14 Jan 2011 12:55:32 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 14 Jan 2011 12:55:29 +0100 Message-Id: <1295006132-29153-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1295006132-29153-1-git-send-email-kraxel@redhat.com> References: <1295006132-29153-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 4/7] vnc: fix numlock+capslock tracking X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- ui/vnc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 495d6d6..0820d99 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1504,7 +1504,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) break; } - if (vs->vd->lock_key_sync && + if (down && vs->vd->lock_key_sync && 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 @@ -1523,7 +1523,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) } } - if (vs->vd->lock_key_sync && + if (down && vs->vd->lock_key_sync && ((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