Re: raw keyboard events (via callback)



On Wed, 2004-09-15 at 20:38 -0500, P. George wrote:
> just events triggered by keydowns/keyups for the modifier keys (or the 
> whole keyboard, INCLUDING the modifier keys).

X/GTK will give you this *for the window with focus*, but won't really
tell you which keys are the modifier keys. If you get a key event
Super_L for example, that event will not tell you that Super_L is bound
to modifier bit 4 (or bit 3, or whatever it's bound to). You can query
the modmap with a separate call and try to figure out which keys are set
to modifier bits. See metacity/src/keybindings.c for some example code.

Window managers normally use XGrabKey() on the root window, but using
that in an app will cause problems because you'll intercept all the keys
that are supposed to be going to other apps. This is a global thing.

The closest to what you want is probably to use the XKB extension, which
has every feature under the sun probably including this one, but you'll
have to read its 100-page spec to try and decipher how to use it (and it
will only work on X displays that support XKB, which is most recent
ones).

Anyway, none of this will give you what I would call "raw" key events,
those are only available internal to the X server. Anything you get will
be filtered through the server's interpretation, which is defined by XKB
in recent servers.

Havoc





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]