xkb: wrong KeySym at first start of X

Peter Hutterer peter.hutterer at who-t.net
Wed Aug 12 18:24:53 PDT 2009


On Thu, Aug 13, 2009 at 03:18:38AM +0200, chris_honschu at gmx.de wrote:
> On Thursday, 13. August 2009, Peter Hutterer wrote:
> > On Thu, Aug 13, 2009 at 02:48:33AM +0200, chris_honschu at gmx.de wrote:
> > > On Thursday, 13. August 2009, Peter Hutterer wrote:
> > > > On Tue, Aug 11, 2009 at 04:15:37PM +0200, chris_honschu at gmx.de wrote:
> > > > > at the first start and at the very beginning of a running X
> > > > > the KeySym changes from a wrong value to the correct
> > > > > one.
> > > > > Is this a bug? Because thereby my window-manager
> > > > > keymappings go wrong.
> > > > >
> > > > > I have a 'de' (German) keyboard (qwertz).
> > > > > For the first ~14k loops of xkeytest the button "y" is
> > > > > referred to a 'z':
> > > > >
> > > > > loop-nr.:0 testing KeyCode=52 -> KeySym 0x7a name=z
> > > > > loop-nr.:13906 testing KeyCode=52 -> KeySym 0x79 name=y
> > > >
> > > > the internal virtual keyboard is initialized with the default layout
> > > > ('us'), the physical keyboard with 'de' per your configuration. once
> > > > you hit a key on the german layout, this layout it copied over into the
> > > > virtual one and the virtual keyboard also has a german layout.
> > > > so the change from 'us' to 'de' is not accidental.
> > >
> > > /tmp/xkeytest:
> > > *** date:
> > > Tue Aug 11 15:13:51 CEST 2009
> > > loop-nr.:0 testing KeyCode=52 -> KeySym 0x7a name=z
> > > *** xprop -root | grep XKB
> > > _XKB_RULES_NAMES(STRING) = "xorg", "pc105", "de", "", ""
> > >
> > > I didn't have a look at the sourcecode of xprop but shouldn't it print
> > > out a 'us' instead of a 'de' keyboard layout,?
> > > So here is a bug in either xprop or in xorg. Am I right?
> >
> > it's a essentially unfixable problem with the property itself.
> >
> > http://bugs.freedesktop.org/show_bug.cgi?id=21669
> > "we only have one property that stores the XKB RMLVO information and this
> > is overwritten by each keyboard on startup. This results in wrong data if
> > there's at least two keyboards with different RMLVO settings."
> 
> Thanks for your very fast answer. This brings light into the darkness ,-)
> 
> I understand: For the window manager that sets the key-mappings very fast at the 
> beginning of a more or less starting Xorg it's essential to listen to 
> MappingNotify as you kindly explained.
> 
> My question is now: Would this MappingNotify report the keysyms in a atomic way 
> so that I can rely on that it is a 'de' or 'us' keymap - or would I end up in a 
> mess of a combination of both when I parse them?

you only get the mapping notify events for the core keyboard but there isn't
a lot of things to synchronise or be atomic about in the server.

in the client you simply need to make sure you get the new table before
processing the next keycode. 
if have a grab on, say, 'z' you need to ungrab the previous keycode and grab
the new keycode if you find that the keycodes for this symbol have changed.

Cheers,
  Peter



More information about the xorg mailing list