diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2017-06-27 11:30:51 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2017-07-04 13:43:35 +1000 |
commit | d698de6e68b10ea9d394465688db2a9731e5f9cd (patch) | |
tree | 26e8b933250882b3c385fab216c61a94e7a741f4 /test | |
parent | 7c983d6088fe5098f3236b1400d98dbbf92712df (diff) | |
download | libinput-d698de6e68b10ea9d394465688db2a9731e5f9cd.tar.gz |
touchpad: send a left button event when we move out of topbuttons and click
We used to completely ignore a finger that was within the top software button
area and then moved to the main area and remained there for a timeout. This
avoids erroneous pointer movements when the user moves the finger while using
the trackpoint.
But we also ignored physical clicks, something we should not be doing. This
patch fixes that behavior: we still ignore the finger for movement, but a
physical click now triggers a left click once we've been in the area for the
timeout.
This new behavior doesn't apply within the timeout, i.e. if a finger is in the
right top button area, moves out and immediately clicks, we still trigger a
right click. This avoids erroneous switches to left-clicks when the finger is
at the edge of the button area and moves out during the press.
Related to: https://bugs.freedesktop.org/show_bug.cgi?id=99212
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r-- | test/test-touchpad-buttons.c | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/test/test-touchpad-buttons.c b/test/test-touchpad-buttons.c index 0037ba77..9f38e833 100644 --- a/test/test-touchpad-buttons.c +++ b/test/test-touchpad-buttons.c @@ -1591,26 +1591,60 @@ START_TEST(clickpad_topsoftbuttons_middle) } END_TEST -START_TEST(clickpad_topsoftbuttons_move_out_ignore) +START_TEST(clickpad_topsoftbuttons_move_out_leftclick_before_timeout) { struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - /* Finger down in top button area, wait past enter timeout + /* Finger down in top right button area, wait past enter timeout Move into main area, wait past leave timeout Click - -> expect no events + -> expect left click */ litest_drain_events(li); - litest_touch_down(dev, 0, 50, 5); + litest_touch_down(dev, 0, 80, 5); libinput_dispatch(li); litest_timeout_softbuttons(); libinput_dispatch(li); litest_assert_empty_queue(li); - litest_touch_move_to(dev, 0, 50, 5, 80, 90, 20, 0); + litest_touch_move_to(dev, 0, 80, 5, 80, 90, 20, 0); + libinput_dispatch(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_touch_up(dev, 0); + + litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(clickpad_topsoftbuttons_move_out_leftclick) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + /* Finger down in top right button area, wait past enter timeout + Move into main area, wait past leave timeout + Click + -> expect left click + */ + + litest_drain_events(li); + + litest_touch_down(dev, 0, 80, 5); + libinput_dispatch(li); + litest_timeout_softbuttons(); + libinput_dispatch(li); + litest_assert_empty_queue(li); + + litest_touch_move_to(dev, 0, 80, 5, 80, 90, 20, 0); libinput_dispatch(li); litest_timeout_softbuttons(); libinput_dispatch(li); @@ -1622,7 +1656,8 @@ START_TEST(clickpad_topsoftbuttons_move_out_ignore) litest_touch_up(dev, 0); - litest_assert_empty_queue(li); + litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); } END_TEST @@ -1998,7 +2033,8 @@ litest_setup_tests_touchpad_buttons(void) litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_left, LITEST_TOPBUTTONPAD, LITEST_ANY); litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_right, LITEST_TOPBUTTONPAD, LITEST_ANY); litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_middle, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_move_out_ignore, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_move_out_leftclick, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_move_out_leftclick_before_timeout, LITEST_TOPBUTTONPAD, LITEST_ANY); litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_clickfinger, LITEST_TOPBUTTONPAD, LITEST_ANY); litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_clickfinger_dev_disabled, LITEST_TOPBUTTONPAD, LITEST_ANY); |