[PATCH] mi: ensure chained button mappings from SD -> MD (#19282)
Peter Hutterer
peter.hutterer at who-t.net
Thu Jan 8 01:35:25 PST 2009
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.
Since the mapping stays fixed for each device, there are no
DeviceMappingNotify events that need to be sent.
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.
> 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>
> > ---
> > mi/mieq.c | 26 ++++++++++++++++++++++++--
> > xkb/ddxDevBtn.c | 2 +-
> > 2 files changed, 25 insertions(+), 3 deletions(-)
> >
> > diff --git a/mi/mieq.c b/mi/mieq.c
> > index 82bbb2c..e1f647d 100644
> > --- a/mi/mieq.c
> > +++ b/mi/mieq.c
> > @@ -277,15 +277,32 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
> > DebugF("[mi] Unknown event type (%d), cannot change id.\n", type);
> > }
> >
> > +static void
> > +FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
> > + EventListPtr master, int count)
> > +{
> > + /* Ensure chained button mappings, i.e. that the detail field is the
> > + * value of the mapped button on the SD, not the physical button */
> > + if (original->u.u.type == DeviceButtonPress || original->u.u.type == DeviceButtonRelease)
> > + {
> > + int btn = original->u.u.detail;
> > + if (!sdev->button)
> > + return; /* Should never happen */
> > +
> > + master->event->u.u.detail = sdev->button->map[btn];
>
> Shouldn't this be master->event[count].u.u.detail... ?
no. all button events are on 0, with count >= 1 exclusively for device valuator
events. And they don't need changing.
Cheers,
Peter
More information about the xorg
mailing list