[PATCH] xkb: Don't press+release keys on key events
Peter Hutterer
peter.hutterer at who-t.net
Thu May 21 17:59:52 PDT 2009
On Wed, May 20, 2009 at 02:46:17PM +0200, Matthias Hopf wrote:
> Some users get F7 delivered to apps when switching from console to X.
> After some debugging I found the culprit, but am unsure whether I'm
> doing something stupid with this patch.
>
> Given the popularity of the xkb layer probably only few can comment here.
> Daniel? Peter?
>
> IMHO the key repeat logic is broken here, Press+Release events should
> only be committed if the key state is down, not for up AND down.
> I verified that key repeat is still working, and so far I couldn't find
> any side effects - but of course I don't have all keyboard layouts and
> special hardware and architectures.
I believe this may be a leftover of the old key repeat code. At least the
evdev driver discards all key repeats in-driver already, so to get two key
events in a row you have to be syncing up xtest's fake input events right.
> From 0f64eab6c2a99d686602d88f33624e3b512843d1 Mon Sep 17 00:00:00 2001
> From: Matthias Hopf <mhopf at suse.de>
> Date: Wed, 20 May 2009 12:41:05 +0200
> Subject: [PATCH] xkb: Don't press+release keys on key events.
This is not correct. You're preventing a fake key press repeat on key
release events if the key is not currently logically down. I'd prefer a more
extensive commit message that explains exactly that.
The behaviour is still there on a key press event. Maybe it should be
removed from there too? daniel?
Cheers,
Peter
> Fixes submission of F7 to apps on switch from console for drivers that switch
> fast enough (Novell bug #141443 from Januar 2006).
> ---
> xkb/xkbPrKeyEv.c | 5 -----
> 1 files changed, 0 insertions(+), 5 deletions(-)
>
> diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
> index effb0ea..a44fcbc 100644
> --- a/xkb/xkbPrKeyEv.c
> +++ b/xkb/xkbPrKeyEv.c
> @@ -85,11 +85,6 @@ unsigned ndx;
> }
> else if (event->type == ET_KeyRelease &&
> (!(keyc->down[key>>3]&(1<<(key&7))))) {
> - XkbLastRepeatEvent= (pointer)event;
> - event->type = ET_KeyPress;
> - XkbHandleActions(keybd, keybd, event);
> - event->type = ET_KeyRelease;
> - XkbHandleActions(keybd, keybd, event);
> XkbLastRepeatEvent= NULL;
> return;
> }
> --
> 1.6.0.2
More information about the xorg-devel
mailing list