aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-03-17 14:08:29 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-03-23 16:36:15 +1000
commitc695234c5c5fd54a6afd12db46a0926ccdd83301 (patch)
tree5177cee87a392abb8c0fa926581244568dc047dd
parentIf we have a touchpad, print so, don't claim we're configuring a tablet. (diff)
downloadxf86-input-evdev-c695234c5c5fd54a6afd12db46a0926ccdd83301.tar.gz
xf86-input-evdev-c695234c5c5fd54a6afd12db46a0926ccdd83301.tar.bz2
xf86-input-evdev-c695234c5c5fd54a6afd12db46a0926ccdd83301.zip
Fix jumpy touchpads by updating old_vals only when reported by the device.
Remember whether ABS_X or ABS_Y were reported before the SYN event and only update the old_vals[0, 1] if we got data for them. Touchpads that reported pressure data before x/y would otherwise update old_x/y with bogus values, leading to jumps when the first x/y coordinates were actually reported. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit d9809d7edd2be714a15115b990286554e2979fb6)
-rw-r--r--src/evdev.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 1d34827..482f7fd 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -342,6 +342,9 @@ EvdevReopenTimer(OsTimerPtr timer, CARD32 time, pointer arg)
return 100; /* come back in 100 ms */
}
+#define ABS_X_VALUE 0x1
+#define ABS_Y_VALUE 0x2
+#define ABS_VALUE 0x4
/**
* Take one input event and process it accordingly.
*/
@@ -392,7 +395,12 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
if (ev->code > ABS_MAX)
break;
pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
- abs = 1;
+ if (ev->code == ABS_X)
+ abs |= ABS_X_VALUE;
+ else if (ev->code == ABS_Y)
+ abs |= ABS_Y_VALUE;
+ else
+ abs |= ABS_VALUE;
break;
case EV_KEY:
@@ -443,18 +451,20 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
case EV_SYN:
/* convert to relative motion for touchpads */
if (abs && (pEvdev->flags & EVDEV_TOUCHPAD)) {
- abs = 0;
- rel = 1;
if (pEvdev->tool) { /* meaning, touch is active */
if (pEvdev->old_vals[0] != -1)
delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0];
if (pEvdev->old_vals[1] != -1)
delta[REL_Y] = pEvdev->vals[1] - pEvdev->old_vals[1];
- pEvdev->old_vals[0] = pEvdev->vals[0];
- pEvdev->old_vals[1] = pEvdev->vals[1];
+ if (abs & ABS_X_VALUE)
+ pEvdev->old_vals[0] = pEvdev->vals[0];
+ if (abs & ABS_Y_VALUE)
+ pEvdev->old_vals[1] = pEvdev->vals[1];
} else {
pEvdev->old_vals[0] = pEvdev->old_vals[1] = -1;
}
+ abs = 0;
+ rel = 1;
}
if (rel) {
@@ -537,6 +547,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
}
}
+#undef ABS_X_VALUE
+#undef ABS_Y_VALUE
+#undef ABS_VALUE
+
/* just a magic number to reduce the number of reads */
#define NUM_EVENTS 16