qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Drung <bdrung@ubuntu.com>
To: Stefan Weil <weil@mail.berlios.de>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] wrong behaviour of caps lock
Date: Fri, 19 Nov 2010 00:58:32 +0100	[thread overview]
Message-ID: <1290124712.2386.6.camel@deep-thought> (raw)
In-Reply-To: <4BCC7FDD.3000902@mail.berlios.de>


[-- Attachment #1.1: Type: text/plain, Size: 2166 bytes --]

Am Montag, den 19.04.2010, 18:07 +0200 schrieb Stefan Weil:
> Kevin Wolf schrieb:
> > Am 19.04.2010 03:23, schrieb Jamie Lokier:
> >> Benjamin Drung wrote:
> >>> - /* SDL does not send the key up event, so we generate it */
> >> Was the original comment just plain wrong?
> >>
> >>> - kbd_put_keycode(keycode);
> >>> - kbd_put_keycode(keycode | 0x80);
> >>> + if (ev->type == SDL_KEYUP) {
> >>> + kbd_put_keycode(keycode | 0x80);
> >>> + } else {
> >>> + kbd_put_keycode(keycode);
> >>> + }
> >> The patch implies that SDL *does* send the key up event.
> >>
> >> Somebody obviously thought that it doesn't, hence the comment.
> >>
> >> So what has changed? Is it different versions of SDL, or does the
> >> patch only work on some hosts / distros?
> >
> > I think we already have had a discussion on this and it turned out that
> > Ubuntu had a "special" version of SDL which changed this behaviour. So
> > it is considered an Ubuntu SDL bug. Googled the old discussion for you:
> >
> > http://www.mail-archive.com/qemu-devel@nongnu.org/msg25246.html
> >
> > Kevin
> 
> My report was based on the Debian testing distribution
> with libsdl components version 1.2.13-5.
> 
> So if it's a bug, both Ubuntu and Debian share it
> (which is not too surprising).
> 
> And as I explained in my previous mail on this thread
> QEMU's caps lock handling is buggy on any distribution.
> 
> Maybe I'll find the time to write a patch until the end
> of this week.

I did more investigation, because kvm has this issue in Debian testing
and Ubuntu 10.10 (maverick). The German NEO2 layout maps the caps lock
key to alt gr. I discovered that libsdl sends a key down and key up
event for caps lock if it is mapped to something else. Therefore you
should only send a key up event if caps lock is really used as caps
lock. Patch for kvm 0.12.5 attached. This works for me. Does it work for
your keyboard layout, too?

You find more Details in the Ubuntu bug #427612 [1] beginning with
comment #29.

[1] https://launchpad.net/bugs/427612

-- 
Benjamin Drung
Ubuntu Developer (www.ubuntu.com) | Debian Maintainer (www.debian.org)

[-- Attachment #1.2: caps-key-up-event.patch --]
[-- Type: text/x-patch, Size: 688 bytes --]

=== modified file 'sdl.c'
--- sdl.c	2010-02-26 16:26:00 +0000
+++ sdl.c	2010-11-18 22:47:20 +0000
@@ -390,10 +390,13 @@
         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);
-        return;
+        /* SDL does not send the key up event for real caps lock, so we generate it */
+        if (ev->keysym.sym == 0x12d) {
+            kbd_put_keycode(keycode);
+            kbd_put_keycode(keycode | 0x80);
+            return;
+        }
+        break;
     }
 
     /* now send the key code */


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2010-11-18 23:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-02 16:02 [Qemu-devel] wrong behaviour of caps lock Benjamin Drung
2010-04-17  9:59 ` Stefan Weil
2010-04-19  1:23 ` Jamie Lokier
2010-04-19  8:38   ` Kevin Wolf
2010-04-19 16:07     ` Stefan Weil
2010-11-18 23:58       ` Benjamin Drung [this message]

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=1290124712.2386.6.camel@deep-thought \
    --to=bdrung@ubuntu.com \
    --cc=aurelien@aurel32.net \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weil@mail.berlios.de \
    /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).