[Xcb] [RFC] xcb/util-keysyms input handling patch
Michael Stapelberg
michael+xcb at stapelberg.de
Fri Oct 12 13:03:36 PDT 2012
Hi Peter,
Michael Stapelberg <michael+xcb at stapelberg.de> writes:
> solve. In case I can confirm that, I’ll happily help with
> testing/implementing.
So I wrote some test code which you can find attached. It’s really
horrible code and I apologize, but it gets the job done. Compile it with
gcc -o xlib-ih xlib-ih.c -lX11 -lXi
The program opens a window and then grabs the keyboard forever (so you
might want to run it via SSH on another computer or keep at vt handy for
killing it). For every XI_KeyPress event, it translates the keycode to a
keysym and prints the name of that keysym.
I have the following questions about it:
1. Is using the function XkbTranslateKeyCode appropriate for this? It
feels slightly kludgy to use XkbBuildCoreState, but I could not
figure out what the correct shift level is for calling
XkbKeycodeToKeysym (it does NOT map 1:1 to the KeyPress’s
mods.effective in all cases).
2. Is getting the core keyboard via XKB correct?
3. To port this code over to XCB, we’d need to implement XInput >= 2.0
plus maybe more of XKB (haven’t checked) plus all the code which Xlib
provides (especially XkbTranslateKeyCode and dependencies), right?
4. Assuming that 3 is true, would it be acceptable to implement the bare
minimum of XI/XKB to get this working? I’m not interested in
implementing full XKB, full Xinput or a full port of additional
functions. I just want to correctly get Keysyms for key presses.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xlib-ih.c
Type: text/x-csrc
Size: 3068 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20121012/40749f17/attachment.c>
-------------- next part --------------
--
Best regards,
Michael
More information about the Xcb
mailing list