[Xcb] Handling keyboard events
Ian Osgood
iano at quirkster.com
Tue Mar 27 12:12:21 PDT 2007
On Mar 27, 2007, at 11:27 AM, Jim Crafton wrote:
> At the risk of looking foolish for a simple question, 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. 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?
>
> Thanks!
>
> Jim Crafton
This is a good question!
XLookupString's general composition of multiple keycodes to keysyms
is one of the thorny areas in Xlib which still needs an XCB
convenience library. One problem is that Xlib acts as an abstraction
layer above both the core input events and the Xinput extension. Note
that XCB has implemented neither the Xinput nor XKB extensions (a
good Google Summer of Code idea!).
The start of a keysym library is in xcb/util/keysyms, which has other
methods which may suffice for your application. A simple example of
its use is in xcb/demo/neko and xcb/demo/app/xte. You can start
looking at the XLookupString implementation in xorg/lib/libX11/src/
KeyBind.c
Ian
More information about the Xcb
mailing list