summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2011-12-14 15:23:36 -0200
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-15 14:58:59 +1000
commit8d6dfd13b0c4177305555294218e366a6cddc83f (patch)
tree670667759a98f7d9ffce5d2e5a21aff676232562
parenta9cdb6590cdf72917cdfeb17e2fcc6a110b2c7d1 (diff)
Fix absolute events with swapped axes
We were correctly swapping the valuator values, but we were not calling valuator_mask_unset() when needed, so the cursor kept jumping to the edges. This patch does the swapping before the main "for", so we don't need to store unswapped_{x,y} and unswapped_isset_{x,y} even when we don't need to swap. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 428d3c1..b1f9b2e 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -436,10 +436,30 @@ EvdevProcessValuators(InputInfoPtr pInfo)
* just works.
*/
else if (pEvdev->abs_queued && pEvdev->in_proximity) {
- int unswapped_x = valuator_mask_get(pEvdev->vals, 0);
- int unswapped_y = valuator_mask_get(pEvdev->vals, 1);
int i;
+ if (pEvdev->swap_axes) {
+ int swapped_isset[2] = {0, 0};
+ int swapped_values[2];
+
+ for(i = 0; i <= 1; i++)
+ if (valuator_mask_isset(pEvdev->vals, i)) {
+ swapped_isset[1 - i] = 1;
+ swapped_values[1 - i] =
+ xf86ScaleAxis(valuator_mask_get(pEvdev->vals, i),
+ pEvdev->absinfo[1 - i].maximum,
+ pEvdev->absinfo[1 - i].minimum,
+ pEvdev->absinfo[i].maximum,
+ pEvdev->absinfo[i].minimum);
+ }
+
+ for (i = 0; i <= 1; i++)
+ if (swapped_isset[i])
+ valuator_mask_set(pEvdev->vals, i, swapped_values[i]);
+ else
+ valuator_mask_unset(pEvdev->vals, i);
+ }
+
for (i = 0; i <= 1; i++) {
int val;
int calib_min;
@@ -458,13 +478,6 @@ EvdevProcessValuators(InputInfoPtr pInfo)
calib_max = pEvdev->calibration.max_y;
}
- if (pEvdev->swap_axes)
- val = xf86ScaleAxis((i == 0 ? unswapped_y : unswapped_x),
- pEvdev->absinfo[i].maximum,
- pEvdev->absinfo[i].minimum,
- pEvdev->absinfo[1 - i].maximum,
- pEvdev->absinfo[1 - i].minimum);
-
if (pEvdev->flags & EVDEV_CALIBRATED)
val = xf86ScaleAxis(val, pEvdev->absinfo[i].maximum,
pEvdev->absinfo[i].minimum, calib_max,