[PATCH evdev] Fix relative events with swapped axes

2011-12-15 Thread przanoni
From: Paulo Zanoni paulo.r.zan...@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.zan...@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

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH evdev] Fix relative events with swapped axes

2011-12-15 Thread Peter Hutterer
On Thu, Dec 15, 2011 at 12:26:37PM -0200, przan...@gmail.com wrote:
 From: Paulo Zanoni paulo.r.zan...@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.zan...@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
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel