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, ...@@ -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, ...@@ -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;
......
...@@ -150,7 +150,6 @@ struct tp_touch { ...@@ -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 */
......
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