Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> --- src/evdev-mt-touchpad.c | 12 ++++++------ src/evdev.h | 13 +++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index cf5fffe..48edb80 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -105,12 +105,12 @@ tp_motion_hysteresis(struct tp_dispatch *tp, if (t->history.count == 0) { t->hysteresis_center = t->point; } else { - x = tp_hysteresis(x, - t->hysteresis_center.x, - tp->hysteresis_margin.x); - y = tp_hysteresis(y, - t->hysteresis_center.y, - tp->hysteresis_margin.y); + x = evdev_hysteresis(x, + t->hysteresis_center.x, + tp->hysteresis_margin.x); + y = evdev_hysteresis(y, + t->hysteresis_center.y, + tp->hysteresis_margin.y); t->hysteresis_center.x = x; t->hysteresis_center.y = y; t->point.x = x; diff --git a/src/evdev.h b/src/evdev.h index 0e08f6d..4171c8a 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -469,4 +469,17 @@ evdev_to_left_handed(struct evdev_device *device, return button; } +static inline int +evdev_hysteresis(int in, int center, int margin) +{ + int diff = in - center; + if (abs(diff) <= margin) + return center; + + if (diff > margin) + return center + diff - margin; + else + return center + diff + margin; +} + #endif /* EVDEV_H */ -- 2.5.5 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel