On some ELAN tablets we get a coordinate jump in the same frame that we put
the tip down. The existing axis smoothing causes that jump to be somewhere in
the middle between the previous and the next coordinates, causing a small
stroke from the smoothed position to the next. Prevent this by resetting the
history on tip down/up so we always take that coordinate.
Fixes #94
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
rc = true;
out:
+ /* The tool position often jumps to a different spot when contact changes.
+ * If tool contact changes, clear the history to prevent axis smoothing
+ * from trying to average over the spatial discontinuity. */
+ if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_CONTACT) ||
+ tablet_has_status(tablet, TABLET_TOOL_LEAVING_CONTACT)) {
+ tablet_history_reset(tablet);
+ }
+
tablet_history_push(tablet, &tablet->axes);
tablet_smoothen_axes(tablet, &axes);