[Xcb] XKB

Michael Stapelberg michael+xcb at stapelberg.de
Mon Aug 9 10:37:16 PDT 2010


Hi Christoph,

First of all: Thanks for your work on XKB in XCB.

I checked out your git repository and tried to port a little proof of concept,
which was partly successful. I do have a few questions now:

1) When receiving an event, how can I access the XKB event type? When using
   Xlib, I can cast it to XkbEvent and access its any.xkb_type property. I did
   not find any type in src/xkb.h which contains "any". Is it missing, maybe?

2) When setting up which events to receive (xcb_xkb_select_events), I need to
   use for example XCB_XKB_EVENT_TYPE_MAP_NOTIFY for the selectAll member,
   while in Xlib, the constant is called XkbMapNotifyMask. Is the one in XCB
   not a mask?

3) I am a bit puzzled about the xcb_xkb_select_events_details_t structure.
   Looking at the code in src/xkb.c, I think it is not actually used when I pass a
   selectAll value of XCB_XKB_EVENT_TYPE_MAP_NOTIFY |
   XCB_XKB_EVENT_TYPE_STATE_NOTIFY, am I right? If not, do you have an example of
   how to set it up?

I attached both proof of concepts (old.c for the Xlib one and main.c for the
XCB one). Beware, the code is very ugly and quickly hacked. That being said,
run it like this:

$ gcc -o old old.c -lX11 && ./old

Or, for the xcb one (I installed my version to /tmp/inst, so your instructions
might be simpler if you just install it to your system. You could use
$(pkg-config --cflags --libs xcb-xkb) then instead):

$ gcc -o main -g main.c -I/tmp/inst/usr/local/include -L/tmp/inst/usr/local/lib \
  -lxcb -lxcb-xkb && LD_LIBRARY_PATH=/tmp/inst/usr/local/lib ./main

When pressing Ctrl or Alt, you should see an event.

Best regards,
Michael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: old.c
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20100809/b21e51a0/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.c
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20100809/b21e51a0/attachment.asc>


More information about the Xcb mailing list