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; int dx, dy;
uint64_t dtime; uint64_t dtime;
const struct device_coords* prev_point;
if (tp->nfingers_down != 1 || if (tp->nfingers_down != 1 ||
tp->nfingers_down != tp->old_nfingers_down) tp->nfingers_down != tp->old_nfingers_down)
return; return;
if (tp->hysteresis.enabled) if (tp->hysteresis.enabled || t->history.count == 0)
return; return;
if (!(tp->queued & TOUCHPAD_EVENT_MOTION)) { if (!(tp->queued & TOUCHPAD_EVENT_MOTION)) {
@ -168,18 +169,12 @@ tp_detect_wobbling(struct tp_dispatch *tp,
return; return;
} }
if (t->last_point.x == 0) { /* first invocation */ prev_point = &tp_motion_history_offset(t, 0)->point;
dx = 0; dx = prev_point->x - t->point.x;
dy = 0; dy = prev_point->y - t->point.y;
} else {
dx = t->last_point.x - t->point.x;
dy = t->last_point.y - t->point.y;
}
dtime = time - tp->hysteresis.last_motion_time; dtime = time - tp->hysteresis.last_motion_time;
tp->hysteresis.last_motion_time = time; tp->hysteresis.last_motion_time = time;
t->last_point = t->point;
if ((dx == 0 && dy != 0) || dtime > ms2us(40)) { if ((dx == 0 && dy != 0) || dtime > ms2us(40)) {
t->hysteresis.x_motion_history = 0; t->hysteresis.x_motion_history = 0;

View file

@ -150,7 +150,6 @@ struct tp_touch {
bool has_ended; /* TRACKING_ID == -1 */ bool has_ended; /* TRACKING_ID == -1 */
bool dirty; bool dirty;
struct device_coords point; struct device_coords point;
struct device_coords last_point;
uint64_t time; uint64_t time;
int pressure; int pressure;
bool is_tool_palm; /* MT_TOOL_PALM */ bool is_tool_palm; /* MT_TOOL_PALM */