touchpad: replace last_point with history.samples

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
This commit is contained in:
Konstantin Kharlamov 2018-06-12 18:53:51 +03:00 committed by Peter Hutterer
parent da3e4ccb6b
commit a23414dd1f
2 changed files with 5 additions and 11 deletions

View file

@ -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;

View file

@ -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 */