nanogui: X11 KEY_UP event
Subject:
Re: X11 KEY_UP event
From:
Timo Ketola ####@####.####
Date:
9 May 2001 05:43:27 -0000
Message-Id: <3AF8D83E.60F57861@Epec.fi>
Greg Haerr wrote:
>
> : I'm a little lost with the X11 driver. I need to know when a key is
> : released and watch for KEY_UP events. Basically it works fine but the
> : problem is the auto repeat function. For every auto repeat cycle I get
> : KEY_DOWN * AND KEY_UP * event (DOWN UP DOWN UP DOWN UP ... DOWN UP; I
> : was expecting a sequence of DOWN DOWN DOWN ... DOWN UP). These extra
> : KEY_UP events makes it impossible to distinguish between multiple key
> : presses and one long press.
> :
> : Is this a property of X11 and is there any way to modify it's behaviour?
>
> Timo,
> Yes, this is an X11 issue. You might want to look at how the Linux
> console scancode driver solves this problem (src/drivers/kbd_ttyscan.c)
> There's an #if 0 on line 345 that basically drops events that don't change
> state. This code needs to be basically inserted into the kbd_x11.c
> x11 kbd driver in the X11_Read function, in near the same area.
Ok, I took a look at the kbd_ttyscan. But wouldn't the fact, that the
X11 sends also a Release event every auto repeat cycle, break that code?
I guess that the tty device gives the autorepeat sequence like this:
press press press ... release. Then the kbd_ttyscan driver would give a
sequence of DOWN DOWN DOWN ... UP, right? The behaviour like that would
be exactly what I was hoping for. Now, the problem is that the X11 seems
to give the autorepeat sequence like this: press release press release
... press release, and the kbd_x11 driver then relays it as DOWN UP DOWN
UP ... DOWN UP. From that sequence I can't tell if it was only one long
press and I guess that the code snippet from the kbd_ttyscan can't help
here. Or am I missing something?
Thanks for replying
--
Timo