[Xcb] Handling keyboard events
Jamey Sharp
jamey at minilop.net
Tue Mar 27 12:29:28 PDT 2007
On Tue, Mar 27, 2007 at 02:27:06PM -0400, Jim Crafton wrote:
> At the risk of looking foolish for a simple question,
This is neither foolish nor particularly simple. :-)
> how does one get the key that the user pressed during a
> XCB_KEY_RELEASE or XCB_KEY_PRESS event? The xcb_key_press_event_t
> struct doesn't appear to have any fields that would store off this
> value.
In the core X protocol, the server sends you a KEYCODE, which is
basically an arbitrary number. It may correspond with your keyboard's
hardware scancode, for example. To interpret this keycode, the core
protocol requires you to look it up in the keyboard mapping, as seen in
the QueryKeyboardMapping request. That gets you a KEYSYM, which is not
the same as a Unicode character, but is often what you want.
> Is there a special function that needs to be called to get this value?
> XLib had a XKeyEvent and a function XLookupString() to allow you to
> get the virtual key code. Is there anything similar in XCB?
Tom beat me to saying it: take a look at the keysyms library in
xcb-util. Note that most of the util libraries are highly experimental
and should not be used in nuclear reactors or really much of anything
else, but let us know if keysyms works for you and if you have things
you'd like improved about it. Patches very much welcome.
--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20070327/5616ffbe/attachment.pgp
More information about the Xcb
mailing list