All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Stefan Weil <weil@mail.berlios.de>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Benjamin Drung <benjamin.drung@gmail.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 0.14] ui/sdl: Fix handling of caps lock and num lock keys
Date: Fri, 04 Feb 2011 06:51:17 -0600	[thread overview]
Message-ID: <4D4BF645.90009@codemonkey.ws> (raw)
In-Reply-To: <1296768907-12798-1-git-send-email-weil@mail.berlios.de>

On 02/03/2011 03:35 PM, Stefan Weil wrote:
> Starting with SDL version 1.2.14, caps lock and num lock keys
> will send a SDL_KEYUP when SDL_DISABLE_LOCK_KEYS=1 is set in
> the environment.
>
> The new code sets the environment unconditionally
> (it won't harm old versions which do not know it).
>
> The workaround for SDL_KEYUP is only compiled with old SDL versions.
>
> A similar patch without handling of old SDL versions was already
> published by Benjamin Drung for Ubuntu.
>
> Cc: Anthony Liguori<aliguori@us.ibm.com>
> Cc: Kevin Wolf<kwolf@redhat.com>
> Cc: Benjamin Drung<benjamin.drung@gmail.com>
> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
>    

Applied to master, Thanks.

Regards,

Anthony Liguori
> ---
>   ui/sdl.c |    8 ++++++++
>   1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/ui/sdl.c b/ui/sdl.c
> index a1458ce..47ac49c 100644
> --- a/ui/sdl.c
> +++ b/ui/sdl.c
> @@ -388,12 +388,16 @@ static void sdl_process_key(SDL_KeyboardEvent *ev)
>           else
>               modifiers_state[keycode] = 1;
>           break;
> +#define QEMU_SDL_VERSION ((SDL_MAJOR_VERSION<<  8) + SDL_MINOR_VERSION)
> +#if QEMU_SDL_VERSION<  0x102 || QEMU_SDL_VERSION == 0x102&&  SDL_PATCHLEVEL<  14
> +        /* SDL versions before 1.2.14 don't support key up for caps/num lock. */
>       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 | SCANCODE_UP);
>           return;
> +#endif
>       }
>
>       /* now send the key code */
> @@ -831,6 +835,10 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
>           setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
>       }
>
> +    /* Enable normal up/down events for Caps-Lock and Num-Lock keys.
> +     * This requires SDL>= 1.2.14. */
> +    setenv("SDL_DISABLE_LOCK_KEYS", "1", 1);
> +
>       flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
>       if (SDL_Init (flags)) {
>           fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
>    

  reply	other threads:[~2011-02-04 12:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090910235343.14184.29717.malonedeb@gangotri.canonical.com>
2010-05-21 11:55 ` [Qemu-devel] [Bug 427612] Re: does not pass pressed caps lock to client Launchpad Bug Tracker
2010-06-02 20:12 ` Anthony Liguori
2010-11-17 23:52 ` Benjamin Drung
2010-11-17 23:55 ` Benjamin Drung
2010-11-18  1:50 ` Serge Hallyn
2010-11-18  1:56 ` Serge Hallyn
2010-11-18 23:46 ` [Qemu-devel] [Bug 427612] Re: kvm sends caps lock key up event twice Benjamin Drung
2010-11-19  3:20   ` [Qemu-devel] " Serge Hallyn
2010-11-18 23:47 ` [Qemu-devel] " Benjamin Drung
2010-11-19  3:19   ` [Qemu-devel] " Serge Hallyn
2010-11-19  9:26 ` [Qemu-devel] " Benjamin Drung
2010-11-19 13:52 ` Serge Hallyn
2010-11-23  0:42 ` Benjamin Drung
2010-11-23 14:30   ` [Qemu-devel] " Serge Hallyn
2010-11-23 19:03   ` [Qemu-devel] " Stefan Weil
2010-11-23 14:53 ` Serge Hallyn
2010-11-24 21:13 ` Launchpad Bug Tracker
2010-11-24 21:15 ` Benjamin Drung
2010-11-24 21:23 ` Launchpad Bug Tracker
2010-11-24 21:44 ` Benjamin Drung
2010-11-25 20:08   ` Stefan Weil
2010-11-27 23:48     ` Benjamin Drung
2011-02-03 21:35       ` [Qemu-devel] [PATCH 0.14] ui/sdl: Fix handling of caps lock and num lock keys Stefan Weil
2011-02-04 12:51         ` Anthony Liguori [this message]
2010-11-24 23:31 ` [Qemu-devel] [Bug 427612] Re: kvm sends caps lock key up event twice Serge Hallyn
2010-11-25 23:45 ` Launchpad Bug Tracker
2010-11-25 23:50 ` Benjamin Drung
2010-12-03 16:15 ` Martin Pitt
2010-12-03 17:51 ` Launchpad Bug Tracker
2010-12-03 23:21 ` Benjamin Drung
2010-12-04 11:41 ` Jean-Baptiste Lallement
2010-12-09 10:55 ` Launchpad Bug Tracker
2012-09-14  9:00 ` Paolo Bonzini

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=4D4BF645.90009@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=aliguori@us.ibm.com \
    --cc=benjamin.drung@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.