[PATCH] mi: ensure chained button mappings from SD -> MD (#19282)

Thomas Jaeger thjaeger at gmail.com
Thu Jan 8 08:19:15 PST 2009


Peter Hutterer wrote:
> On Thu, Jan 08, 2009 at 01:43:39AM -0500, Thomas Jaeger wrote:
>> Alexia: What is the point of remapping buttons willy-nilly before
>> posting an event anyway?  The comment suggests it just servers as a
>> reminder of how remapping works.  It's problematic in that proper
>> DeviceMappingNotify events aren't send and I don't want to think about
>> what could potentially happen if some client calls XTestFakeButtonEvent
>> (let alone XTestFakeDeviceButtonEvent) at the right moment.  The problem
>> in bug #19282 was fixed in ubuntu by simply skipping the remapping step,
>> and I'm not aware of any issues that this may have caused.
> 
> Button maps aren't copied from SDs to MDs, so they are persistent on both
> devices. Which means with chained button mapping, you can configure an MD to
> be left-handed (i.e. 321 button mapping) and any SD attached to this MD will
> assume this mapping. If one SD needs additional mapping (e.g. 2->3), then this
> can be achieved by just remapping this single device.

This is okay.

> Since the mapping stays fixed for each device, there are no
> DeviceMappingNotify events that need to be sent.

The wacom driver changes button mappings on the fly by simply writing
into the device's button map instead of going the SetButtonMapping
route.  Yesterday, I thought that this was completely random, but it
actually tries to copy the mapping that is set up via the xsetwacom
tool.  It doesn't do so correctly, though, shifting the entries by one.
 So it maps button 0 to button 1 and then sends a button 0 press.  It's
kind of amazing that this even works.  Maybe there should be a check in
the X server that rejects such invalid events.

Ping: I can write up a patch.  Is there a public linuxwacom repo anywhere?

> Regarding XTest: this is a problematic situation anyway, and I think that the
> solution to XTest's problem is a virtual slave device attached to the
> respective MD.

Probably a good idea.  This would also solve the problem of XTest events
being sent out before any devices have been used.

> 
>> Peter Hutterer wrote:
>>> After copying the master event, flip the detail field to the mapped button of
>>> the SD, not the physical button. This way if the SD has a mapping 1:3 and the
>>> MD has a mapping of 3:4, a press on button 1 on the SD results in a core event
>>> on button 4.
>>>
>>> X.Org Bug 19282 <http://bugs.freedesktop.org/show_bug.cgi?id=19282>
>>>
>>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>



More information about the xorg mailing list