dvdhrm/kmscon — pull request #15 by bluetech (2012-05-20 17:26:22+00:00)
Title: Update xkb keyboard backend to new libxkbcommon API

Hi David,

Here's a few patches to update to the current libxkbcommon master. The current code hasn't been working with it for a while.

I think you will be pleased with the changelog :) Most of what we had in kbd_xkb.c is now in the library proper, and it also stopped leaking memory. It should be pretty lightweight now, after the initial keymap compilation, which takes a few milliseconds during startup.

Some comments on the commits:

A couple trivial fixes:
6f5e383 kbd: remove "dev" from kbd_dev_keysym_to_string
d4e27ce monitor: fix small memory leak

[ I also run into a memleak which I preferred leaving to you. The eloop isn't free'd, caused by this cycle:
ev_eloop_new -> ev_eloop_new_counter -> ev_eloop_add_counter -> ev_eloop_add_fd -> ev_eloop_ref
ev_eloop_unref -> ev_eloop_rm_counter -> ev_eloop_rm_fd -> ev_eloop_unref
Of course this ^^ one never happens because the ref doesn't go to 0. ]

It seems I caught the codebase during some transition. I didn't want to update both the kbd and the uterm variants, so I removed the old files and fixed the fallout. It was pretty straightforward, so I think it's fine. If not, you can skip it, but it would not build because of the libxkbcommon API change.
4bcca3d input: remove old input and kbd subsystems

And these do the updating. There's still some things left to do, some on the xkbcommon side, and later on kmscon. And xkbcommon is definitely not bug free. But it will get some more stuff soon, some mentioned in the comments, and also keysym-to-unicode (which we still do ourselves), a common config file, logging into an fd instead of stderr, and a few more. I should also mention that libxkbcommon does not handle OOM gracefully, basically it does abort(). I don't think anyone cares about that, so it probably won't be fixed soon. But you should know.
e25740b xkb: add a TODO note to kbd_dev_reset stub
b9ecae0 xkb: produce key events
b47dcae xkb: initialize the xkb objects
8977572 xkb: remove old xkb code and add stubs

Finally, I think that once xkbcommon is stable, we could remove the dumb backend, remove the xproto dependency, and utilize the library to a larger extent. But there's still some time for that.

Thanks,
Ran