Commit a23414dd authored by Konstantin Kharlamov's avatar Konstantin Kharlamov Committed by Peter Hutterer

touchpad: replace last_point with history.samples

Signed-off-by: Konstantin Kharlamov's avatarKonstantin Kharlamov <Hi-Angel@yandex.ru>
parent da3e4ccb
......@@ -155,12 +155,13 @@ tp_detect_wobbling(struct tp_dispatch *tp,
{
int dx, dy;
uint64_t dtime;
const struct device_coords* prev_point;
if (tp->nfingers_down != 1 ||
tp->nfingers_down != tp->old_nfingers_down)
return;
if (tp->hysteresis.enabled)
if (tp->hysteresis.enabled || t->history.count == 0)
return;
if (!(tp->queued & TOUCHPAD_EVENT_MOTION)) {
......@@ -168,18 +169,12 @@ tp_detect_wobbling(struct tp_dispatch *tp,
return;
}
if (t->last_point.x == 0) { /* first invocation */
dx = 0;
dy = 0;
} else {
dx = t->last_point.x - t->point.x;
dy = t->last_point.y - t->point.y;
}
prev_point = &tp_motion_history_offset(t, 0)->point;
dx = prev_point->x - t->point.x;
dy = prev_point->y - t->point.y;
dtime = time - tp->hysteresis.last_motion_time;
tp->hysteresis.last_motion_time = time;
t->last_point = t->point;
if ((dx == 0 && dy != 0) || dtime > ms2us(40)) {
t->hysteresis.x_motion_history = 0;
......
......@@ -150,7 +150,6 @@ struct tp_touch {
bool has_ended; /* TRACKING_ID == -1 */
bool dirty;
struct device_coords point;
struct device_coords last_point;
uint64_t time;
int pressure;
bool is_tool_palm; /* MT_TOOL_PALM */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment