diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 5c10dc35..1acf1111 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -193,9 +193,10 @@ tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch) if (tp->semi_mt) move_threshold = TP_MM_TO_DPI_NORMALIZED(4); else - move_threshold = TP_MM_TO_DPI_NORMALIZED(3); + move_threshold = TP_MM_TO_DPI_NORMALIZED(2); delta = device_delta(touch->point, touch->gesture.initial); + normalized = tp_normalize_delta(tp, delta); if (normalized_length(normalized) < move_threshold) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 35d0d853..f45d6bbc 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -438,8 +438,8 @@ tp_unpin_finger(struct tp_dispatch *tp, struct tp_touch *t) ydist = abs(t->point.y - t->pinned.center.y); ydist *= tp->buttons.motion_dist.y_scale_coeff; - /* 3mm movement -> unpin */ - if (hypot(xdist, ydist) >= 3.0) { + /* 1.5mm movement -> unpin */ + if (hypot(xdist, ydist) >= 1.5) { t->pinned.is_pinned = false; return; } diff --git a/test/gestures.c b/test/gestures.c index 8b6639f3..b9d73257 100644 --- a/test/gestures.c +++ b/test/gestures.c @@ -287,16 +287,16 @@ START_TEST(gestures_spread) litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y); libinput_dispatch(li); - for (i = 0; i < 8; i++) { + for (i = 0; i < 15; i++) { litest_push_event_frame(dev); if (dir_x > 0.0) - dir_x += 3; + dir_x += 2; else if (dir_x < 0.0) - dir_x -= 3; + dir_x -= 2; if (dir_y > 0.0) - dir_y += 3; + dir_y += 2; else if (dir_y < 0.0) - dir_y -= 3; + dir_y -= 2; litest_touch_move(dev, 0, 50 + dir_x, diff --git a/test/touchpad.c b/test/touchpad.c index 0f6e46c6..927d7258 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -862,12 +862,19 @@ START_TEST(clickpad_finger_pin) struct libinput *li = dev->libinput; struct libevdev *evdev = dev->evdev; const struct input_absinfo *abs; + double w, h; + double dist; abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); ck_assert_notnull(abs); if (abs->resolution == 0) return; + if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0) + return; + + dist = 100.0/max(w, h); + litest_drain_events(li); /* make sure the movement generates pointer events when @@ -881,9 +888,9 @@ START_TEST(clickpad_finger_pin) litest_button_click(dev, BTN_LEFT, true); litest_drain_events(li); - litest_touch_move_to(dev, 0, 50, 50, 51, 51, 10, 1); - litest_touch_move_to(dev, 0, 51, 51, 49, 49, 10, 1); - litest_touch_move_to(dev, 0, 49, 49, 50, 50, 10, 1); + litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10, 1); + litest_touch_move_to(dev, 0, 50 + dist, 50 + dist, 50, 50, 10, 1); + litest_touch_move_to(dev, 0, 50, 50, 50 - dist, 50 - dist, 10, 1); litest_assert_empty_queue(li); @@ -891,9 +898,9 @@ START_TEST(clickpad_finger_pin) litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); /* still pinned after release */ - litest_touch_move_to(dev, 0, 50, 50, 51, 51, 10, 1); - litest_touch_move_to(dev, 0, 51, 51, 49, 49, 10, 1); - litest_touch_move_to(dev, 0, 49, 49, 50, 50, 10, 1); + litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10, 1); + litest_touch_move_to(dev, 0, 50 + dist, 50 + dist, 50, 50, 10, 1); + litest_touch_move_to(dev, 0, 50, 50, 50 - dist, 50 - dist, 10, 1); litest_assert_empty_queue(li);