From 37af67c666f4f74f263851e7e04853264509126c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 5 Mar 2015 18:39:15 +1000 Subject: [PATCH 1/7] test: fix/disable two tap test for semi-mt devices On a semi-mt device lifting slot 0 before slot 1 makes slots 1 become slot 0 (with the matching coordinate jump), potentially triggering the tap movement threshold. On one test we can just swap the release order, the other test we need to disable (the _inverted version of this test tests the other order anyway). Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- test/touchpad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/touchpad.c b/test/touchpad.c index 8077f8e3..5c8f579e 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -2570,8 +2570,8 @@ START_TEST(touchpad_left_handed_tapping_2fg) litest_touch_down(dev, 0, 50, 50); litest_touch_down(dev, 1, 70, 50); - litest_touch_up(dev, 0); litest_touch_up(dev, 1); + litest_touch_up(dev, 0); libinput_dispatch(li); litest_timeout_tap(); @@ -3356,7 +3356,7 @@ int main(int argc, char **argv) { litest_add("touchpad:tap", touchpad_2fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD); litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:tap", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); litest_add("touchpad:tap", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); litest_add("touchpad:tap", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD); From 3f7efc134e689811dd3dc062ecfb0084fc36ef33 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 5 Mar 2015 16:48:47 +1000 Subject: [PATCH 2/7] touchpad: return normalized deltas from tp_get_delta All callers except the tap motion threshold call tp_get_delta() followed by tp_filter_motion() - the latter normalized it before calling into the accleration code. Move the normalization into tp_get_delta() so we don't deal with device-specific coordinates but normalized deltas instead. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad.c | 5 +++-- src/evdev-mt-touchpad.h | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index b90d84c5..9b065221 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -64,8 +64,8 @@ tp_filter_motion(struct tp_dispatch *tp, { struct motion_params motion; - motion.dx = *dx * tp->accel.x_scale_coeff; - motion.dy = *dy * tp->accel.y_scale_coeff; + motion.dx = *dx; + motion.dy = *dy; if (dx_unaccel) *dx_unaccel = motion.dx; @@ -269,6 +269,7 @@ tp_get_delta(struct tp_touch *t, double *dx, double *dy) tp_motion_history_offset(t, 1)->y, tp_motion_history_offset(t, 2)->y, tp_motion_history_offset(t, 3)->y); + tp_normalize_delta(t->tp, dx, dy); } static void diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index f04cc112..1b8b560f 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -283,6 +283,13 @@ struct tp_dispatch { #define tp_for_each_touch(_tp, _t) \ for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++) +static inline void +tp_normalize_delta(struct tp_dispatch *tp, double *dx, double *dy) +{ + *dx = *dx * tp->accel.x_scale_coeff; + *dy = *dy * tp->accel.y_scale_coeff; +} + void tp_get_delta(struct tp_touch *t, double *dx, double *dy); From 7a54360ed3adbf2e49a894715ee864d2e7c357eb Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 6 Mar 2015 14:18:59 +1000 Subject: [PATCH 3/7] Move DEFAULT_MOUSE_DPI to evdev.h, provide a conversion macro Ideally we want to specify various thresholds in mm, but not all touchpads set the hardware resolutions. Rather than conditions to check for resolutions everywhere, use a macro to give us a normalized value that we use for motion as well. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad.c | 5 ++--- src/evdev-mt-touchpad.h | 5 +++++ src/evdev.h | 3 +++ src/filter.h | 3 --- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 9b065221..88088503 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -994,9 +994,8 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal) fixed in the actual filter code. */ { - const double MAGIC = 0.4; - tp->accel.x_scale_coeff *= MAGIC; - tp->accel.y_scale_coeff *= MAGIC; + tp->accel.x_scale_coeff *= TP_MAGIC_SLOWDOWN; + tp->accel.y_scale_coeff *= TP_MAGIC_SLOWDOWN; } } else { /* diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 1b8b560f..de8b60d7 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -34,6 +34,11 @@ #define VENDOR_ID_APPLE 0x5ac +/* Touchpad slowdown factor, see the FIXME in tp_init_accel() */ +#define TP_MAGIC_SLOWDOWN 0.4 +/* Convert mm to a distance normalized to DEFAULT_MOUSE_DPI */ +#define TP_MM_TO_DPI_NORMALIZED(mm) (DEFAULT_MOUSE_DPI/25.4 * TP_MAGIC_SLOWDOWN * mm) + enum touchpad_event { TOUCHPAD_EVENT_NONE = 0, TOUCHPAD_EVENT_MOTION = (1 << 0), diff --git a/src/evdev.h b/src/evdev.h index 72082e5a..9e8d6af0 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -33,6 +33,9 @@ #include "libinput-private.h" #include "timer.h" +/* The HW DPI rate we normalize to before calculating pointer acceleration */ +#define DEFAULT_MOUSE_DPI 1000 + enum evdev_event_type { EVDEV_NONE, EVDEV_ABSOLUTE_TOUCH_DOWN, diff --git a/src/filter.h b/src/filter.h index 9f6223d2..9e903303 100644 --- a/src/filter.h +++ b/src/filter.h @@ -28,9 +28,6 @@ #include #include -/* The HW DPI rate we normalize to before calculating pointer acceleration */ -#define DEFAULT_MOUSE_DPI 1000 - struct motion_params { double dx, dy; /* in units/ms @ DEFAULT_MOUSE_DPI resolution */ }; From 38ee2c7aacd23a99e20b608f45a7d1292e1feb10 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Mar 2015 08:24:36 +1000 Subject: [PATCH 4/7] touchpad: change tap motion threshold to 3 mm Previous code used a device coordinate threshold of 300 which won't work on Elantech touchpads (1280 vs the ~4000 that synaptics has). Convert to normalized DPI and reduce the threshold to 3mm. https://bugs.freedesktop.org/show_bug.cgi?id=89206 Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad-tap.c | 11 ++++++++--- src/evdev-mt-touchpad.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c index 228eb842..c0475080 100644 --- a/src/evdev-mt-touchpad-tap.c +++ b/src/evdev-mt-touchpad-tap.c @@ -37,7 +37,7 @@ #define CASE_RETURN_STRING(a) case a: return #a; #define DEFAULT_TAP_TIMEOUT_PERIOD 180 -#define DEFAULT_TAP_MOVE_THRESHOLD 30 +#define DEFAULT_TAP_MOVE_THRESHOLD TP_MM_TO_DPI_NORMALIZED(3) enum tap_event { TAP_EVENT_TOUCH = 12, @@ -527,12 +527,15 @@ tp_tap_handle_event(struct tp_dispatch *tp, } static bool -tp_tap_exceeds_motion_threshold(struct tp_dispatch *tp, struct tp_touch *t) +tp_tap_exceeds_motion_threshold(struct tp_dispatch *tp, + struct tp_touch *t) { int threshold = DEFAULT_TAP_MOVE_THRESHOLD; double dx, dy; - tp_get_delta(t, &dx, &dy); + dx = abs(t->tap.initial_x - t->x); + dy = abs(t->tap.initial_y - t->y); + tp_normalize_delta(tp, &dx, &dy); return dx * dx + dy * dy > threshold * threshold; } @@ -568,6 +571,8 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time) if (t->state == TOUCH_BEGIN) { t->tap.state = TAP_TOUCH_STATE_TOUCH; + t->tap.initial_x = t->x; + t->tap.initial_y = t->y; tp_tap_handle_event(tp, t, TAP_EVENT_TOUCH, time); } else if (t->state == TOUCH_END) { tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time); diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index de8b60d7..2a55ed4b 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -167,6 +167,7 @@ struct tp_touch { struct { enum tp_tap_touch_state state; + int32_t initial_x, initial_y; } tap; struct { From 82be678e79219aed5a19151c4607514791f6d2af Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 6 Mar 2015 12:35:56 +1000 Subject: [PATCH 5/7] touchpad: annotate all coordinates that are in device coordinates Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad.h | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 2a55ed4b..fc75f93b 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -132,8 +132,8 @@ struct tp_touch { enum touch_state state; bool has_ended; /* TRACKING_ID == -1 */ bool dirty; - int32_t x; - int32_t y; + int32_t x; /* in device coordinates */ + int32_t y; /* in device coordinates */ uint64_t millis; struct { @@ -143,8 +143,8 @@ struct tp_touch { } history; struct { - int32_t center_x; - int32_t center_y; + int32_t center_x; /* in device coordinates */ + int32_t center_y; /* in device coordinates */ } hysteresis; /* A pinned touchpoint is the one that pressed the physical button @@ -153,8 +153,8 @@ struct tp_touch { */ struct { bool is_pinned; - int32_t center_x; - int32_t center_y; + int32_t center_x; /* in device coordinates */ + int32_t center_y; /* in device coordinates */ } pinned; /* Software-button state and timeout if applicable */ @@ -167,7 +167,7 @@ struct tp_touch { struct { enum tp_tap_touch_state state; - int32_t initial_x, initial_y; + int32_t initial_x, initial_y; /* in device coordinates */ } tap; struct { @@ -180,7 +180,8 @@ struct tp_touch { struct { bool is_palm; - int32_t x, y; /* first coordinates if is_palm == true */ + int32_t x, y; /* first coordinates if is_palm == true, + in device coordinates */ uint32_t time; /* first timestamp if is_palm == true */ } palm; }; @@ -206,8 +207,8 @@ struct tp_dispatch { unsigned int fake_touches; struct { - int32_t margin_x; - int32_t margin_y; + int32_t margin_x; /* in device coordiantes */ + int32_t margin_y; /* in device coordiantes */ } hysteresis; struct { @@ -238,14 +239,14 @@ struct tp_dispatch { * The buttons are split according to the edge settings. */ struct { - int32_t top_edge; - int32_t rightbutton_left_edge; + int32_t top_edge; /* in device coordinates */ + int32_t rightbutton_left_edge; /* in device coordinates */ } bottom_area; struct { - int32_t bottom_edge; - int32_t rightbutton_left_edge; - int32_t leftbutton_right_edge; + int32_t bottom_edge; /* in device coordinates */ + int32_t rightbutton_left_edge; /* in device coordinates */ + int32_t leftbutton_right_edge; /* in device coordinates */ } top_area; struct evdev_device *trackpoint; @@ -257,8 +258,8 @@ struct tp_dispatch { struct { struct libinput_device_config_scroll_method config_method; enum libinput_config_scroll_method method; - int32_t right_edge; - int32_t bottom_edge; + int32_t right_edge; /* in device coordinates */ + int32_t bottom_edge; /* in device coordinates */ } scroll; enum touchpad_event queued; @@ -273,8 +274,8 @@ struct tp_dispatch { } tap; struct { - int32_t right_edge; - int32_t left_edge; + int32_t right_edge; /* in device coordinates */ + int32_t left_edge; /* in device coordinates */ } palm; struct { From 1cebdc7a2b3dc8c5d256beddf8e600d184f00b49 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 6 Mar 2015 14:36:31 +1000 Subject: [PATCH 6/7] touchpad: accumulate the initial scroll edge delta The previous setting of 10 wasn't 10 mm, it was used against the deltas normalized to a 1000DPI mouse, i.e. closer to 4mm. It was also also per-event, so a slow movement or a high-frequency touchpad can struggle to meet the threshold. Change the trigger to be ~5 mm from the initial touch down, accumulated until we either meet the threshold or the timeout expires. The first scroll event includes the delta since the touch down rather than the most recent delta. This removes the delay otherwise seen in scrolling and makes the scroll motion match the finger motion. This accumulated delta only applies when exceeding the motion threshold, when the timeout triggers the switch to scrolling the first delta posted is the current delta. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad-edge-scroll.c | 37 ++++++++++++++++++++++++++--- src/evdev-mt-touchpad.h | 2 ++ test/litest.c | 6 +++++ test/litest.h | 1 + test/touchpad.c | 16 +++++++++---- 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c index 28f29c2f..3adde8c7 100644 --- a/src/evdev-mt-touchpad-edge-scroll.c +++ b/src/evdev-mt-touchpad-edge-scroll.c @@ -34,8 +34,7 @@ avoid accidentally locking in scrolling mode when trying to use the entire touchpad to move the pointer. The user can wait for the timeout to trigger to do a small scroll. */ -/* In mm for touchpads with valid resolution, see tp_init_accel() */ -#define DEFAULT_SCROLL_THRESHOLD 10.0 +#define DEFAULT_SCROLL_THRESHOLD TP_MM_TO_DPI_NORMALIZED(5) enum scroll_event { SCROLL_EVENT_TOUCH, @@ -78,6 +77,8 @@ tp_edge_scroll_set_state(struct tp_dispatch *tp, break; case EDGE_SCROLL_TOUCH_STATE_EDGE_NEW: t->scroll.edge = tp_touch_get_edge(tp, t); + t->scroll.initial_x = t->x; + t->scroll.initial_y = t->y; libinput_timer_set(&t->scroll.timer, t->millis + DEFAULT_SCROLL_LOCK_TIMEOUT); break; @@ -315,6 +316,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) struct tp_touch *t; enum libinput_pointer_axis axis; double dx, dy, *delta; + double initial_dx, initial_dy, *initial_delta; if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_EDGE) return 0; @@ -338,10 +340,12 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) case EDGE_RIGHT: axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; delta = &dy; + initial_delta = &initial_dy; break; case EDGE_BOTTOM: axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL; delta = &dx; + initial_delta = &initial_dx; break; default: /* EDGE_RIGHT | EDGE_BOTTOM */ continue; /* Don't know direction yet, skip */ @@ -350,7 +354,34 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) tp_get_delta(t, &dx, &dy); tp_filter_motion(tp, &dx, &dy, NULL, NULL, time); - if (fabs(*delta) < t->scroll.threshold) + switch (t->scroll.edge_state) { + case EDGE_SCROLL_TOUCH_STATE_NONE: + case EDGE_SCROLL_TOUCH_STATE_AREA: + log_bug_libinput(device->seat->libinput, + "unexpected scroll state %d\n", + t->scroll.edge_state); + break; + case EDGE_SCROLL_TOUCH_STATE_EDGE_NEW: + initial_dx = t->x - t->scroll.initial_x; + initial_dy = t->y - t->scroll.initial_y; + tp_normalize_delta(tp, + &initial_dx, + &initial_dy); + if (fabs(*initial_delta) < t->scroll.threshold) { + dx = 0.0; + dy = 0.0; + } else { + dx = initial_dx; + dy = initial_dy; + } + break; + case EDGE_SCROLL_TOUCH_STATE_EDGE: + if (fabs(*delta) < t->scroll.threshold) + *delta = 0.0; + break; + } + + if (*delta == 0.0) continue; pointer_notify_axis(device, time, diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index fc75f93b..239bddd8 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -176,6 +176,8 @@ struct tp_touch { int direction; double threshold; struct libinput_timer timer; + int32_t initial_x; /* in device coordinates */ + int32_t initial_y; /* in device coordinates */ } scroll; struct { diff --git a/test/litest.c b/test/litest.c index 4d04b52c..36464462 100644 --- a/test/litest.c +++ b/test/litest.c @@ -1390,6 +1390,12 @@ litest_timeout_finger_switch(void) msleep(120); } +void +litest_timeout_edgescroll(void) +{ + msleep(300); +} + void litest_push_event_frame(struct litest_device *dev) { diff --git a/test/litest.h b/test/litest.h index 8f16851e..e85b511e 100644 --- a/test/litest.h +++ b/test/litest.h @@ -183,6 +183,7 @@ struct libevdev_uinput * litest_create_uinput_abs_device(const char *name, void litest_timeout_tap(void); void litest_timeout_softbuttons(void); void litest_timeout_buttonscroll(void); +void litest_timeout_edgescroll(void); void litest_timeout_finger_switch(void); void litest_push_event_frame(struct litest_device *dev); diff --git a/test/touchpad.c b/test/touchpad.c index 5c8f579e..ff4edb04 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -2057,7 +2057,7 @@ START_TEST(touchpad_edge_scroll) } END_TEST -START_TEST(touchpad_edge_scroll_slow_distance) +START_TEST(touchpad_edge_scroll_timeout) { struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; @@ -2067,6 +2067,10 @@ START_TEST(touchpad_edge_scroll_slow_distance) litest_drain_events(li); litest_touch_down(dev, 0, 99, 20); + libinput_dispatch(li); + litest_timeout_edgescroll(); + libinput_dispatch(li); + litest_touch_move_to(dev, 0, 99, 20, 99, 80, 60, 10); litest_touch_up(dev, 0); libinput_dispatch(li); @@ -2074,6 +2078,8 @@ START_TEST(touchpad_edge_scroll_slow_distance) event = libinput_get_event(li); ck_assert_notnull(event); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); + while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE) { double axisval; ck_assert_int_eq(libinput_event_get_type(event), @@ -2105,10 +2111,10 @@ START_TEST(touchpad_edge_scroll_no_motion) litest_drain_events(li); - litest_touch_down(dev, 0, 99, 20); - litest_touch_move_to(dev, 0, 99, 20, 99, 60, 10, 0); + litest_touch_down(dev, 0, 99, 10); + litest_touch_move_to(dev, 0, 99, 10, 99, 70, 10, 0); /* moving outside -> no motion event */ - litest_touch_move_to(dev, 0, 99, 60, 20, 80, 10, 0); + litest_touch_move_to(dev, 0, 99, 70, 20, 80, 10, 0); /* moving down outside edge once scrolling had started -> scroll */ litest_touch_move_to(dev, 0, 20, 80, 40, 99, 10, 0); litest_touch_up(dev, 0); @@ -3427,7 +3433,7 @@ int main(int argc, char **argv) { litest_add("touchpad:scroll", touchpad_edge_scroll, LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY); litest_add("touchpad:scroll", touchpad_edge_scroll_no_motion, LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY); litest_add("touchpad:scroll", touchpad_edge_scroll_no_edge_after_motion, LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_slow_distance, LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_timeout, LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY); litest_add("touchpad:scroll", touchpad_edge_scroll_source, LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY); litest_add("touchpad:palm", touchpad_palm_detect_at_edge, LITEST_TOUCHPAD, LITEST_ANY); From 8ffc2134083ee3c0984b9abc4a9194062899be42 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Mar 2015 14:22:56 +0100 Subject: [PATCH 7/7] touchpad: Remove unnecessary edge scroll threshold variable Now that we've separate handling of the EDGE_NEW vs EDGE states in tp_edge_scroll_post_events() we can drop the threshold variable, in EDGE_NEW we always want to check against DEFAULT_SCROLL_THRESHOLD and in the EDGE state we only want to make sure that the delta != 0.0 which is already checked later on in tp_edge_scroll_post_events(). Signed-off-by: Hans de Goede Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad-edge-scroll.c | 7 +------ src/evdev-mt-touchpad.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c index 3adde8c7..a7936b61 100644 --- a/src/evdev-mt-touchpad-edge-scroll.c +++ b/src/evdev-mt-touchpad-edge-scroll.c @@ -73,7 +73,6 @@ tp_edge_scroll_set_state(struct tp_dispatch *tp, switch (state) { case EDGE_SCROLL_TOUCH_STATE_NONE: t->scroll.edge = EDGE_NONE; - t->scroll.threshold = DEFAULT_SCROLL_THRESHOLD; break; case EDGE_SCROLL_TOUCH_STATE_EDGE_NEW: t->scroll.edge = tp_touch_get_edge(tp, t); @@ -83,7 +82,6 @@ tp_edge_scroll_set_state(struct tp_dispatch *tp, t->millis + DEFAULT_SCROLL_LOCK_TIMEOUT); break; case EDGE_SCROLL_TOUCH_STATE_EDGE: - t->scroll.threshold = 0.01; /* Do not allow 0.0 events */ break; case EDGE_SCROLL_TOUCH_STATE_AREA: t->scroll.edge = EDGE_NONE; @@ -265,7 +263,6 @@ tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device) tp_for_each_touch(tp, t) { t->scroll.direction = -1; - t->scroll.threshold = DEFAULT_SCROLL_THRESHOLD; libinput_timer_init(&t->scroll.timer, device->base.seat->libinput, tp_edge_scroll_handle_timeout, t); @@ -367,7 +364,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) tp_normalize_delta(tp, &initial_dx, &initial_dy); - if (fabs(*initial_delta) < t->scroll.threshold) { + if (fabs(*initial_delta) < DEFAULT_SCROLL_THRESHOLD) { dx = 0.0; dy = 0.0; } else { @@ -376,8 +373,6 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) } break; case EDGE_SCROLL_TOUCH_STATE_EDGE: - if (fabs(*delta) < t->scroll.threshold) - *delta = 0.0; break; } diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 239bddd8..aa6de69c 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -174,7 +174,6 @@ struct tp_touch { enum tp_edge_scroll_touch_state edge_state; uint32_t edge; int direction; - double threshold; struct libinput_timer timer; int32_t initial_x; /* in device coordinates */ int32_t initial_y; /* in device coordinates */