[PATCH] mi: ensure chained button mappings from SD -> MD (#19282)
Thomas Jaeger
thjaeger at gmail.com
Wed Jan 7 22:43:39 PST 2009
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.
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... ?
More information about the xorg
mailing list