From patchwork Fri Dec 11 10:25:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 40906 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 BC770B7BC0 for ; Fri, 11 Dec 2009 21:26:13 +1100 (EST) Received: from localhost ([127.0.0.1]:40206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJ2hN-0005KH-Lf for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2009 05:26:09 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NJ2ga-0005JE-G2 for qemu-devel@nongnu.org; Fri, 11 Dec 2009 05:25:20 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NJ2gV-0005Gw-9l for qemu-devel@nongnu.org; Fri, 11 Dec 2009 05:25:19 -0500 Received: from [199.232.76.173] (port=37768 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJ2gV-0005Gt-4V for qemu-devel@nongnu.org; Fri, 11 Dec 2009 05:25:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63102) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NJ2gV-0006WY-0m for qemu-devel@nongnu.org; Fri, 11 Dec 2009 05:25:15 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBBAPDwL011104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Dec 2009 05:25:13 -0500 Received: from zweiblum.home.kraxel.org (vpn2-9-170.ams2.redhat.com [10.36.9.170]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBBAPAUM015669; Fri, 11 Dec 2009 05:25:11 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 5268670FB4; Fri, 11 Dec 2009 11:25:09 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 11 Dec 2009 11:25:07 +0100 Message-Id: <1260527107-7128-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [FOR 0.12 PATCH] vnc: fix capslock tracking logic. 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 The capslock tracking logic added by commit 6b1325029d80455b9da7cd7bd84a88cb915b867c doesn't work correctly for vnc clients without EXT_KEY_EVENT support. The reason is that qemu converts keysyms for letters to lowercase for the keysym2scancode lookup. It then also passes the lowercase value down to do_key_event(), but the capslock tracking code needs it with the correct case to work properly. This patch adds a new variable for the lowercase keysym so we'll keep the unmodified value for do_key_event(). The keysym2scancode is not needed with EXT_KEY_EVENT capable clients like any app based on the gtk-vnc widget, so I missed that case in testing ... Signed-off-by: Gerd Hoffmann --- vnc.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/vnc.c b/vnc.c index 32c4678..39c0d98 100644 --- a/vnc.c +++ b/vnc.c @@ -1506,11 +1506,13 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) static void key_event(VncState *vs, int down, uint32_t sym) { int keycode; + int lsym = sym; - if (sym >= 'A' && sym <= 'Z' && is_graphic_console()) - sym = sym - 'A' + 'a'; + if (lsym >= 'A' && lsym <= 'Z' && is_graphic_console()) { + lsym = lsym - 'A' + 'a'; + } - keycode = keysym2scancode(vs->vd->kbd_layout, sym & 0xFFFF); + keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF); do_key_event(vs, down, keycode, sym); }