KeyPress/Release and modifiers

Samuel Thibault samuel.thibault at ens-lyon.org
Fri Jun 8 17:35:27 PDT 2007


Hi,

Glynn Clements, le Fri 08 Jun 2007 23:43:51 +0100, a écrit :
> Samuel Thibault wrote:
> 
> > I have some program that needs to track all pressures/releases of a
> > given key that I access through modifiers (shift-a for instance), and I
> > have a problem with the modifier: if I do
> > 
> > - press shift
> > - press a
> > - release shift
> > - release a
> > 
> > Key events are KeyPress Shift_L, KeyPress 'A', KeyRelease Shift_L,
> > KeyRelease 'a'.
> 
> No, the actual X events are probably:
> 
> 	type = KeyPress   keycode = 50
> 	type = KeyPress   keycode = 38
> 	type = KeyRelease keycode = 50
> 	type = KeyRelease keycode = 38

Ah, yes of course, sorry, I was blindly looking at the result of xev.

> If you're referring to some higher-level toolkit, try asking in a
> forum which is specific to that toolkit. Or try to bypass the toolkit.

It's libX11 and its XLookupString() function :)

Then maybe what I should just do is on the second event (for which
XLookupString gives me XK_A), remember the keycode, and when getting the
fourth event, notice that its the same keycode, and here realize that
the key was release (i.e. this time not match the keysym, but the
keycode)?

Samuel



More information about the xorg mailing list