keymap-dump: use correct format specifiers

For keycodes, groups, levels, etc, which are unsigned. The really proper
inttypes.h ones seem a bit much though.

Signed-off-by: Ran Benita <ran234@gmail.com>
xkbcomp: handle empty keymaps

We should handle empty xkb_keycode and xkb_symbol sections, since
xkbcomp handles them, and apparently XQuartz uses it. There are also
files for it in xkeyboard-config (rules=base model=empty layout=empty,
which translate to keycodes/empty and symbols/empty).

https://bugs.freedesktop.org/show_bug.cgi?id=67654

Reported-By: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
scanner: allow empty key name literals

Some keymaps actually have this, like the quartz.xkb which is tested. We
need to support these.

https://bugs.freedesktop.org/show_bug.cgi?id=67654

Reported-By: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
build: use AM_LDFLAGS for general flags

We want -no-undefined for every library so do it implictly.

Signed-off-by: Ran Benita <ran234@gmail.com>
build: make all symbols in libtest visible

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap: share XkbEscapeMapName()

So we can use it outside src/xkbcomp.
We also rename it to xkb_escape_section_name that's more clear in this
case.

Signed-off-by: Ran Benita <ran234@gmail.com>
keymap: share xkb_keymap_new()

We need it outside this file.

Signed-off-by: Ran Benita <ran234@gmail.com>
Make some symbols visible for other .so's

libxkbcommon-x11.so uses these symbols from libxbkcommon.so, but they
are not part of the API, so we need to export them.

TODO: Find a better solution to this. Maybe just share the code.

Signed-off-by: Ran Benita <ran234@gmail.com>
x11: add XKB protocol keymap and state creation support

These are function to create an xkb_keymap directly from XKB requests
to the X server. This opens up the possibility for X clients to use
xcb + xcb-xkb + xkbcommon as a proper replacement for Xlib + xkbfile for
keyboard support.

The X11 support must be enabled with --enable-x11 for now.
The functions are in xkbcommon/xkbcommon-x11.h. It depends on a recent
libxcb with xkb enabled.

Why not just use the RMLVO that the server puts in the _XKB_RULES_NAMES
property? This does not account for custom keymaps, on-the-fly keymap
modifications, remote clients, etc., so is not a proper solution in
practice. Now, the client just needs to recreate the keymap in response
to a change in the server's keymap (as Xlib clients do with
XRefreshKeyboardMapping() and friends).

Signed-off-by: Ran Benita <ran234@gmail.com>
test: rename test/interactive to interactive-evdev

And share the key-printing functions. In preparation for adding more
interactive-* variants.

Signed-off-by: Ran Benita <ran234@gmail.com>
x11: add a couple of tests

Add two tests:

    ./test/interactive-x11
which is like test/interactive-evdev, but should behave exactly like your
X keyboard and react to state and keymap changes - in other words, just
like typing in xterm. Press ESC to exit.

    ./test/x11
which currently should only print out the same keymap as
    xkbcomp $DISPLAY out.xkb
(modulo some whitespace and some constructs we do not support.)

Signed-off-by: Ran Benita <ran234@gmail.com>