lack of GetModifierMapping/SetModifierMapping symmetry

Pierre Ossman ossman at cendio.se
Thu Apr 30 00:14:43 PDT 2009


On Thu, 30 Apr 2009 12:25:50 +1000
Peter Hutterer <peter.hutterer at who-t.net> wrote:

> On Tue, Apr 28, 2009 at 04:07:37PM +0200, Pierre Ossman wrote:
> > 
> > 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.
> 

In which case I'd consider the mechanism for adding new keyboards
broken. If the idea is that the modifier mapping should be global, then
adding a new keyboard with a different mapping should either a) change
the global mapping, or b) overwrite the mapping on the new keyboard
with the global one.

The current behaviour is just random and magical.

> > 
> > 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.
> 

This is not a behaviour that has been with us for years. It was added
for xserver 1.3. So apparently modifying just the active keyboard was
not a major problem until then.

Daniel did not describe why the change was needed in his commit message
unfortunately.

> 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?
>  

I do, but it gets overwritten by the mapping of another keyboard.

I've done a quick hack that does a SwitchCoreKeyboard() to the VNC
keyboard once it gets the "on" call to its keyboard proc. That seems to
work well enough for the Xvnc case.

I'm not sure what side effects that method will have when it comes to
using libvnc.so with a "real" X server though, so I haven't dared
commit that workaround permanently yet.

Rgds
-- 
Pierre Ossman            OpenSource-based Thin Client Technology
System Developer         Telephone: +46-13-21 46 00
Cendio AB                Web: http://www.cendio.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20090430/c0947910/attachment.pgp 


More information about the xorg-devel mailing list