bluetech/kmscon — comment on commit dcb6a76e92f3b4d99e1f39a3eaa25e073bd656b4
File: src/input.h line 47
By bluetech:

Hi,

I started the libxkbcommon integration but you inspired me to finish it up today :) Let me tell you, it's a cold world out there with some X server delivering nice events to you. I have put two new branchs in my repo:
- input-fixed - this fixes a couple of your comments:
* Changed the copyright.
* Moved the input_device prototypes to input.c.
* Also moved the code around a bit (no changes), I hope you have no particular dislike for redundant prototypes..
- input-xkb - branched of off input-fixed and implements xkb support. You can look at it and try for more details.

As for your other comments:
- Is there a specific TODO which worries you?
- I don't think the input subsystem should deal with unicode too much, it should just deliver events. So I chose to give out a single UCS-4 value in the input event, much like SDL does it. This is also the only ready-made path I found to translate keysyms to unicode. It would also be much trouble to support combining characters (etc..) in the input system - remember that the combining characters come /after/ the base character.
- Dead keys /should/ be supported through xkb, but libxkbcommon does not handle it. It can tell you when a dead key was pressed (e.g. dead_grave, dead_circum keysyms), but the actual work here is done by Xlib's input method modules. It depends on locale and some text files (see the Compose files and compose.dir file in /usr/share/X11/locale). It can probably be done but not straightforward without Xlib (and probably also /with/ it).
- Shortcuts - the modifier state is passed along with every input event.

I should also add the libxkbcommon is not nearly as easy to use as it might appear. You need to duplicate and understand a lot of the X server and Xlib keyboard handling just to start use it. But the alternatives I can think of are:
- Use some ad-hoc solution directly with the evdev codes - very hard to get something satisfying and otherwise NIH.
- Port the kernel xkb equivalent (e.g. /usr/share/kbd/*). I think DirectFB does this. I haven't looked at it but probably don't want that either.
All in all it works OK now.