diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-17 14:08:29 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-17 14:15:00 +1000 |
commit | d9809d7edd2be714a15115b990286554e2979fb6 (patch) | |
tree | e6276b491711004aec9c8e8073e3cfa644e130a0 | |
parent | If we have a touchpad, print so, don't claim we're configuring a tablet. (diff) | |
download | xf86-input-evdev-d9809d7edd2be714a15115b990286554e2979fb6.tar.gz xf86-input-evdev-d9809d7edd2be714a15115b990286554e2979fb6.tar.bz2 xf86-input-evdev-d9809d7edd2be714a15115b990286554e2979fb6.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>
-rw-r--r-- | src/evdev.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/evdev.c b/src/evdev.c index 911fdd2..fc52be8 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -343,6 +343,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. */ @@ -393,7 +396,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: @@ -444,18 +452,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) { @@ -538,6 +548,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 |