[PATCH evdev] Fix relative events with swapped axes

Peter Hutterer peter.hutterer at who-t.net
Thu Dec 15 22:09:37 PST 2011


On Thu, Dec 15, 2011 at 12:26:37PM -0200, przanoni at gmail.com wrote:
> From: Paulo Zanoni <paulo.r.zanoni at intel.com>
> 
> After we swap the axes, we only call valuator_mask_set for axes that are
> not zero, so we need to unset the axes that became zero when swapped.
> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> ---
>  src/evdev.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> Same bug as the previous one, but now with relative events.
> 
> Easy to test: just use xinput to change the "Evdev Axes Swap" property
> of your mouse and try to control it. Try to move on a straight vertical
> or horizontal line to see what happens.
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index b1f9b2e..562c7e7 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -408,6 +408,10 @@ EvdevProcessValuators(InputInfoPtr pInfo)
>              tmp = pEvdev->delta[REL_X];
>              pEvdev->delta[REL_X] = pEvdev->delta[REL_Y];
>              pEvdev->delta[REL_Y] = tmp;
> +            if (pEvdev->delta[REL_X] == 0)
> +                valuator_mask_unset(pEvdev->vals, REL_X);
> +            if (pEvdev->delta[REL_Y] == 0)
> +                valuator_mask_unset(pEvdev->vals, REL_Y);
>          }
>          if (pEvdev->invert_x)
>              pEvdev->delta[REL_X] *= -1;
> -- 
> 1.7.7.3

   8d6dfd1..7909975  master -> master

thanks

Cheers,
  Peter


More information about the xorg-devel mailing list