touchpad: only edge-scroll while the finger is in the edge area

When the touch leaves the area for edge scrolling after starting to scroll,
discard any movement. This signals to the user that they've left the area and
forces them to lift the finger to switch back to motion. If the finger moves
back into the area, scrolling continues.

https://bugs.freedesktop.org/show_bug.cgi?id=91323

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2015-07-13 14:14:42 +10:00
parent 206a4bf441
commit d3b9302187
2 changed files with 31 additions and 0 deletions

View file

@ -360,6 +360,11 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
if (t->palm.state != PALM_NONE)
continue;
/* only scroll with the finger in the previous edge */
if (t->scroll.edge &&
(tp_touch_get_edge(tp, t) & t->scroll.edge) == 0)
continue;
switch (t->scroll.edge) {
case EDGE_NONE:
if (t->scroll.direction != -1) {

View file

@ -2098,6 +2098,31 @@ START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll)
}
END_TEST
START_TEST(touchpad_edge_scroll_into_area)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
enable_edge_scroll(dev);
litest_drain_events(li);
/* move into area, move vertically, move back to edge */
litest_touch_down(dev, 0, 99, 20);
litest_touch_move_to(dev, 0, 99, 20, 99, 50, 10, 2);
litest_touch_move_to(dev, 0, 99, 50, 20, 50, 10, 2);
litest_assert_only_typed_events(li,
LIBINPUT_EVENT_POINTER_AXIS);
litest_touch_move_to(dev, 0, 20, 50, 20, 20, 10, 2);
litest_touch_move_to(dev, 0, 20, 20, 99, 20, 10, 2);
litest_assert_empty_queue(li);
litest_touch_move_to(dev, 0, 99, 20, 99, 50, 10, 2);
litest_assert_only_typed_events(li,
LIBINPUT_EVENT_POINTER_AXIS);
}
END_TEST
static int
touchpad_has_palm_detect_size(struct litest_device *dev)
{
@ -4385,6 +4410,7 @@ litest_setup_tests(void)
litest_add("touchpad:scroll", touchpad_edge_scroll_within_buttonareas, LITEST_CLICKPAD, LITEST_ANY);
litest_add("touchpad:scroll", touchpad_edge_scroll_buttonareas_click_stops_scroll, LITEST_CLICKPAD, LITEST_ANY);
litest_add("touchpad:scroll", touchpad_edge_scroll_clickfinger_click_stops_scroll, LITEST_CLICKPAD, LITEST_ANY);
litest_add("touchpad:scroll", touchpad_edge_scroll_into_area, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:palm", touchpad_palm_detect_at_edge, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:palm", touchpad_palm_detect_at_bottom_corners, LITEST_TOUCHPAD, LITEST_CLICKPAD);