lack of GetModifierMapping/SetModifierMapping symmetry

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 29 19:25:50 PDT 2009


On Tue, Apr 28, 2009 at 04:07:37PM +0200, Pierre Ossman wrote:
> I'm having a bit of a problem with Xvnc here and I need to understand
> the core design a bit more.
> 
> The basic problem is that some client does GetModifierMapping followed
> by a SetModifierMapping. This has the effect of completely nuking the
> modifier mapping tables.
> 
> The reason this happens is how Xorg handles the mapping between the
> multiple keyboards internally and the single keyboard exposed via X11.
> A call to GetModifierMapping gives you the mappings for the currently
> active keyboard, but SetModifierMapping modifies the mappings for all
> keyboards (strictly speaking, all core keyboards).

Assuming that SetModifierMapping works on all keyboards, GetModifierMapping
from any keyboard is identical to any other one. This theory applies to a
couple of calls that allow to query or apply magic on an input device.

> Now since Xvnc shares most of its code with libvnc.so (the addon to a
> running Xorg server), it adds a second keyboard and does not try to
> make it the primary one. Since Xorg wants a primary keyboard, it
> creates a dummy one which is basically blank. So the client mentioned
> above will read the empty mappings from this dummy keyboard and write
> them to the VNC keyboard.
> 
> I'm not entirely sure how to fix this. I'd like to understand why
> GetModifierMapping/SetModifierMapping are implemented the way they are
> first though. Does anyone have any insight into that?

For years the server looked the same so clients relied on a certain behaviour.
Now, with multiple keyboards that may all be independent we have to balance
between doing the right thing and not breaking clients.

MPX gets rid of this in parts because the requests only work on a single
master device at a time. If you only have a single MD however, the behaviour
shouldn't be any different.

The fix for you in libvnc/Xvnc would simply be to initialise a default mapping
for the magic keyboard, wouldn't it?
 
Cheers,
  Peter


More information about the xorg-devel mailing list