summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-03-30 11:36:59 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-03-30 14:07:26 +1000
commitaa901211252f0e492893a56d3ec368fbe327255b (patch)
treeb3127bf0818d3f3e91510ae1f6fc44284ddb16f9 /src
parentb5527fa4c73da687774971ddd7cf6ad2016f89e7 (diff)
touchpad: reset the motion history on significant negative pressure changes
Resetting the motion history has the side-effect of swallowing movements, we don't calculate deltas until we have 4 motion events. During a finger release, we're likely to get a large pressure change between two events, resetting the motion history prevents the cursor from jumping on release. The value of 7 found by trial-and-error, tested on the T440 and T450 hardware. The absolute value is highly variable but recordings show that the pressure changes only by 1 or 2 units during normal interaction. Higher pressure changes are during finger position changes but since those should not cause a jump anyway, we tend to win there too. Currently only enabled for negative pressure changes, let's see how we go with that. https://bugs.freedesktop.org/show_bug.cgi?id=94379 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad.c4
-rw-r--r--src/evdev-mt-touchpad.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index e16aecbb..0640974f 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -335,6 +335,7 @@ tp_process_absolute(struct tp_dispatch *tp,
tp_end_sequence(tp, t, time);
break;
case ABS_MT_PRESSURE:
+ t->pressure_delta = e->value - t->pressure;
t->pressure = e->value;
t->dirty = true;
tp->queued |= TOUCHPAD_EVENT_OTHERAXIS;
@@ -946,6 +947,9 @@ tp_process_state(struct tp_dispatch *tp, uint64_t time)
if (!t->dirty)
continue;
+ if (t->pressure_delta < -7)
+ tp_motion_history_reset(t);
+
tp_thumb_detect(tp, t, time);
tp_palm_detect(tp, t, time);
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 1f05a03e..d1dae839 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -154,6 +154,7 @@ struct tp_touch {
uint64_t millis;
int distance; /* distance == 0 means touch */
int pressure;
+ int pressure_delta;
struct {
/* A quirk mostly used on Synaptics touchpads. In a