xkb database broken

Cameron Hutchison lists at xdna.net
Wed Jun 21 02:23:07 BST 2006

Tollef Fog Heen wrote:
>* Danilo Å egan 

>| If, however, there is no Ubuntu bug, you may want to report one and link
>| it to upstream in some way.

>As the guy who is doing XKB in Ubuntu, I agree with upstream here.
>It's a bug in the GNOME control center and a totally valid
>configuration from the X/XKB POV.

I agree that it is possible to have multiple keycodes map to the same
keysym, but what is not valid is that there are keycode to keysym
mappings defined that shouldn't be.

For example, the logitech_base model defines:
    key <I2F> { [ XF86AudioRaiseVolume ] };
    key <I30> { [ XF86AudioRaiseVolume ] };

This is not correct for *all* logitech keyboards - some, mine included,
do not generate the I2F keycode at all. In that case, it should not
be in the map. It's a bogus mapping that makes it easier to keep the
proliferation of keyboard models down. That may make it easier to define
the XKB configuration, but that does not make it correct.

The upstream bug report makes the comment that a keysym maps to a vector
of keycodes, yet XKeysymToKeycode(3) returns only a single value. In
order to get the vector, you have to get the whole keyboard map and scan
it for the keysyms.

If it is a valid X/XKB configuration to have multiple keycodes for
a keysym, shouldn't it provide an API to get that mapping? There is
a disconnect between the capability of X/XKB and its API. It should
probably be fixed one way or another.

My point here is that while the key map may have the flexibility to map
multiple keycodes to a keysym (by the nature of the direction of the
mapping), the API does not allow multiple mappings. The capability of
X/XKB is an artifact of the implementation, whereas the API is explicitly
defined as having a one-to-one mapping. Is it formally stated in X
documentation that it is valid to have the same keysym defined for
multple keycodes?

I should note that I'm not an X expert, just a long time user. It may
well be explicitly stated that it is valid (not just possible) to do
this form of mapping, but I haven't yet seen it.

All that said, I've been looking into the gnome control center to fix
this there, and found the problem goes further than that. Rhythmbox does
an XGrabKey on the multimedia keys, and makes the same assumption that
you can do an XKeysymToKeycode() followed by an XGrabKey() with the

It is necessary to check all applications that use the multimedia keys
to make sure they dont do the same thing.


Cameron Hutchison

More information about the ubuntu-devel mailing list