mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 19:50:25 +01:00
Merge branch 'edge-scroll-on-edge-only'
This commit is contained in:
commit
6352b0175d
2 changed files with 34 additions and 22 deletions
|
|
@ -285,30 +285,11 @@ int
|
|||
tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device)
|
||||
{
|
||||
struct tp_touch *t;
|
||||
int width, height;
|
||||
int edge_width, edge_height;
|
||||
|
||||
width = device->abs.dimensions.x;
|
||||
height = device->abs.dimensions.y;
|
||||
|
||||
switch (tp->model) {
|
||||
case MODEL_ALPS:
|
||||
edge_width = width * .15;
|
||||
edge_height = height * .15;
|
||||
break;
|
||||
case MODEL_APPLETOUCH: /* unibody are all clickpads, so N/A */
|
||||
edge_width = width * .085;
|
||||
edge_height = height * .085;
|
||||
break;
|
||||
default:
|
||||
/* For elantech and synaptics, note for lenovo #40 series,
|
||||
* e.g. the T440s min/max are the absolute edges, not the
|
||||
* recommended ones as usual with synaptics.
|
||||
*/
|
||||
edge_width = width * .04;
|
||||
edge_height = height * .054;
|
||||
break;
|
||||
}
|
||||
/* 7mm edge size */
|
||||
edge_width = device->abs.absinfo_x->resolution * 7;
|
||||
edge_height = device->abs.absinfo_y->resolution * 7;
|
||||
|
||||
tp->scroll.right_edge = device->abs.absinfo_x->maximum - edge_width;
|
||||
tp->scroll.bottom_edge = device->abs.absinfo_y->maximum - edge_height;
|
||||
|
|
@ -379,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) {
|
||||
|
|
|
|||
|
|
@ -2105,6 +2105,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)
|
||||
{
|
||||
|
|
@ -4506,6 +4531,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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue