From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfsFx-0001S8-Ib for qemu-devel@nongnu.org; Fri, 12 Feb 2010 04:56:13 -0500 Received: from [199.232.76.173] (port=51178 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfsFw-0001Rl-EY for qemu-devel@nongnu.org; Fri, 12 Feb 2010 04:56:12 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfsFu-00025O-DM for qemu-devel@nongnu.org; Fri, 12 Feb 2010 04:56:11 -0500 Received: from mx20.gnu.org ([199.232.41.8]:56543) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NfsFu-0001bm-06 for qemu-devel@nongnu.org; Fri, 12 Feb 2010 04:56:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfsF5-0007Ju-I6 for qemu-devel@nongnu.org; Fri, 12 Feb 2010 04:55:19 -0500 Message-ID: <4B752548.1040108@redhat.com> Date: Fri, 12 Feb 2010 10:54:16 +0100 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] Qemu does not pass pressed caps lock to client References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shahar Havivi Cc: qemu-devel@nongnu.org, bdrung@ubuntu.com Am 11.02.2010 22:13, schrieb Shahar Havivi: > Qemu have a hack for capslock that is not working with Ubuntu. > attached patch that fix it, as describe in this bug: > https://bugs.launchpad.net/qemu/+bug/427612 > > Signed-off-by: Shahar Havivi > > --- > sdl.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/sdl.c b/sdl.c > index cf27ad2..b3d5049 100644 > --- a/sdl.c > +++ b/sdl.c > @@ -390,9 +390,10 @@ static void sdl_process_key(SDL_KeyboardEvent *ev) > break; > case 0x45: /* num lock */ > case 0x3a: /* caps lock */ > - /* SDL does not send the key up event, so we generate it */ > - kbd_put_keycode(keycode); > - kbd_put_keycode(keycode | 0x80); > + if (ev->type == SDL_KEYUP) > + kbd_put_keycode(keycode | 0x80); > + else > + kbd_put_keycode(keycode); > return; > } > The previous code explicitly says the SDL doesn't send the key up event. If you think this is wrong generally, this definitely needs an explanation in the commit message, Also it could use an explanation of _why_ it doesn't work with Ubuntu - I assume they use either a newer or a patched SDL version which does generate these events? As you did not provide these explanations, I assume that this just happens to work for your specific Ubuntu version and is wrong for some other systems. What about always generating both keycodes as we currently do, but ignoring the event if ev->type == SDL_KEYUP? This should work with any SDL version. Kevin