enable edge scrolling on clickpads (#1225579)
This commit is contained in:
parent
b66bfe236f
commit
f91e7233fc
60
0001-test-move-enable_edge_scroll-up.patch
Normal file
60
0001-test-move-enable_edge_scroll-up.patch
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
From 820376e1d3136d903b97588aa547e84e6de16e66 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||||
|
Date: Fri, 3 Jul 2015 15:17:33 +1000
|
||||||
|
Subject: [PATCH libinput 1/3] test: move enable_edge_scroll up
|
||||||
|
|
||||||
|
No functional changes, just so we can group those helpers together.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||||
|
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
|
||||||
|
---
|
||||||
|
test/touchpad.c | 26 +++++++++++++-------------
|
||||||
|
1 file changed, 13 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/touchpad.c b/test/touchpad.c
|
||||||
|
index 443c8c1..60c1df1 100644
|
||||||
|
--- a/test/touchpad.c
|
||||||
|
+++ b/test/touchpad.c
|
||||||
|
@@ -32,6 +32,19 @@
|
||||||
|
#include "libinput-util.h"
|
||||||
|
#include "litest.h"
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+enable_edge_scroll(struct litest_device *dev)
|
||||||
|
+{
|
||||||
|
+ enum libinput_config_status status, expected;
|
||||||
|
+ struct libinput_device *device = dev->libinput_device;
|
||||||
|
+
|
||||||
|
+ status = libinput_device_config_scroll_set_method(device,
|
||||||
|
+ LIBINPUT_CONFIG_SCROLL_EDGE);
|
||||||
|
+
|
||||||
|
+ expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||||
|
+ litest_assert_int_eq(status, expected);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
START_TEST(touchpad_1fg_motion)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
@@ -1442,19 +1455,6 @@ START_TEST(touchpad_scroll_natural)
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
-static void
|
||||||
|
-enable_edge_scroll(struct litest_device *dev)
|
||||||
|
-{
|
||||||
|
- enum libinput_config_status status, expected;
|
||||||
|
- struct libinput_device *device = dev->libinput_device;
|
||||||
|
-
|
||||||
|
- status = libinput_device_config_scroll_set_method(device,
|
||||||
|
- LIBINPUT_CONFIG_SCROLL_EDGE);
|
||||||
|
-
|
||||||
|
- expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||||
|
- litest_assert_int_eq(status, expected);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
START_TEST(touchpad_edge_scroll)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
--
|
||||||
|
2.4.3
|
||||||
|
|
240
0002-test-add-helper-function-for-enabling-click-methods.patch
Normal file
240
0002-test-add-helper-function-for-enabling-click-methods.patch
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
From 1aba453326a18bc97c4aa763e3cff30d14357871 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||||
|
Date: Fri, 3 Jul 2015 15:23:41 +1000
|
||||||
|
Subject: [PATCH libinput 2/3] test: add helper function for enabling click
|
||||||
|
methods
|
||||||
|
|
||||||
|
Makes the test code easier to read. In tests where we explicitly check the API
|
||||||
|
the real calls were left in place.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||||
|
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
|
||||||
|
---
|
||||||
|
test/touchpad.c | 89 ++++++++++++++++++++++++++-------------------------------
|
||||||
|
1 file changed, 41 insertions(+), 48 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/touchpad.c b/test/touchpad.c
|
||||||
|
index 60c1df1..4eed097 100644
|
||||||
|
--- a/test/touchpad.c
|
||||||
|
+++ b/test/touchpad.c
|
||||||
|
@@ -45,6 +45,30 @@ enable_edge_scroll(struct litest_device *dev)
|
||||||
|
litest_assert_int_eq(status, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+enable_clickfinger(struct litest_device *dev)
|
||||||
|
+{
|
||||||
|
+ enum libinput_config_status status, expected;
|
||||||
|
+ struct libinput_device *device = dev->libinput_device;
|
||||||
|
+
|
||||||
|
+ status = libinput_device_config_click_set_method(device,
|
||||||
|
+ LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
+ expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||||
|
+ litest_assert_int_eq(status, expected);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+enable_buttonareas(struct litest_device *dev)
|
||||||
|
+{
|
||||||
|
+ enum libinput_config_status status, expected;
|
||||||
|
+ struct libinput_device *device = dev->libinput_device;
|
||||||
|
+
|
||||||
|
+ status = libinput_device_config_click_set_method(device,
|
||||||
|
+ LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||||
|
+ expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||||
|
+ litest_assert_int_eq(status, expected);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
START_TEST(touchpad_1fg_motion)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
@@ -192,11 +216,8 @@ START_TEST(touchpad_1fg_clickfinger)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
- enum libinput_config_status status;
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
@@ -220,11 +241,8 @@ START_TEST(touchpad_1fg_clickfinger_no_touch)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
- enum libinput_config_status status;
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
@@ -246,11 +264,8 @@ START_TEST(touchpad_2fg_clickfinger)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
- enum libinput_config_status status;
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
@@ -277,8 +292,8 @@ START_TEST(touchpad_2fg_clickfinger_distance)
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
|
||||||
|
- libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
+
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
litest_touch_down(dev, 0, 90, 50);
|
||||||
|
@@ -320,14 +335,11 @@ END_TEST
|
||||||
|
START_TEST(touchpad_clickfinger_to_area_method)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
- enum libinput_config_status status;
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_buttonareas(dev);
|
||||||
|
|
||||||
|
litest_touch_down(dev, 0, 90, 90);
|
||||||
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
||||||
|
@@ -342,9 +354,7 @@ START_TEST(touchpad_clickfinger_to_area_method)
|
||||||
|
litest_assert_button_event(li, BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
@@ -368,14 +378,11 @@ END_TEST
|
||||||
|
START_TEST(touchpad_clickfinger_to_area_method_while_down)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
- enum libinput_config_status status;
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_buttonareas(dev);
|
||||||
|
|
||||||
|
litest_touch_down(dev, 0, 90, 90);
|
||||||
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
||||||
|
@@ -384,9 +391,7 @@ START_TEST(touchpad_clickfinger_to_area_method_while_down)
|
||||||
|
litest_assert_button_event(li, BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
|
||||||
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
||||||
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||||
|
@@ -418,12 +423,9 @@ END_TEST
|
||||||
|
START_TEST(touchpad_area_to_clickfinger_method)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
- enum libinput_config_status status;
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
@@ -441,9 +443,7 @@ START_TEST(touchpad_area_to_clickfinger_method)
|
||||||
|
litest_assert_button_event(li, BTN_LEFT,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_buttonareas(dev);
|
||||||
|
|
||||||
|
litest_touch_down(dev, 0, 90, 90);
|
||||||
|
litest_event(dev, EV_KEY, BTN_LEFT, 1);
|
||||||
|
@@ -464,12 +464,9 @@ END_TEST
|
||||||
|
START_TEST(touchpad_area_to_clickfinger_method_while_down)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
- enum libinput_config_status status;
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
@@ -480,9 +477,7 @@ START_TEST(touchpad_area_to_clickfinger_method_while_down)
|
||||||
|
litest_assert_button_event(li, BTN_LEFT,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
|
||||||
|
- status = libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||||
|
- ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ enable_buttonareas(dev);
|
||||||
|
|
||||||
|
litest_event(dev, EV_KEY, BTN_LEFT, 0);
|
||||||
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||||
|
@@ -534,8 +529,7 @@ START_TEST(clickpad_btn_left)
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
|
||||||
|
- libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
|
||||||
|
+ enable_buttonareas(dev);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
@@ -1137,8 +1131,8 @@ START_TEST(clickpad_topsoftbuttons_clickfinger)
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
|
||||||
|
- libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
+
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
litest_touch_down(dev, 0, 90, 5);
|
||||||
|
@@ -1182,10 +1176,9 @@ START_TEST(clickpad_topsoftbuttons_clickfinger_dev_disabled)
|
||||||
|
struct litest_device *trackpoint = litest_add_device(li,
|
||||||
|
LITEST_TRACKPOINT);
|
||||||
|
|
||||||
|
- libinput_device_config_click_set_method(dev->libinput_device,
|
||||||
|
- LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
|
||||||
|
libinput_device_config_send_events_set_mode(dev->libinput_device,
|
||||||
|
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
litest_touch_down(dev, 0, 90, 5);
|
||||||
|
--
|
||||||
|
2.4.3
|
||||||
|
|
352
0003-touchpad-allow-edge-scrolling-on-clickpads.patch
Normal file
352
0003-touchpad-allow-edge-scrolling-on-clickpads.patch
Normal file
@ -0,0 +1,352 @@
|
|||||||
|
From d76adf6a52bdc5239b76f0ec738eb02d6261ac7c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||||
|
Date: Fri, 3 Jul 2015 14:33:41 +1000
|
||||||
|
Subject: [PATCH libinput 3/3] touchpad: allow edge scrolling on clickpads
|
||||||
|
|
||||||
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||||
|
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
|
||||||
|
---
|
||||||
|
doc/scrolling.dox | 6 +-
|
||||||
|
src/evdev-mt-touchpad-buttons.c | 4 +
|
||||||
|
src/evdev-mt-touchpad-edge-scroll.c | 21 +++-
|
||||||
|
src/evdev-mt-touchpad.c | 5 +-
|
||||||
|
test/touchpad.c | 211 +++++++++++++++++++++++++++++++++++-
|
||||||
|
5 files changed, 230 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/doc/scrolling.dox b/doc/scrolling.dox
|
||||||
|
index 1ecd033..658fe4b 100644
|
||||||
|
--- a/doc/scrolling.dox
|
||||||
|
+++ b/doc/scrolling.dox
|
||||||
|
@@ -55,10 +55,8 @@ scroll).
|
||||||
|
Due to the layout of the edges, diagonal scrolling is not possible. The
|
||||||
|
behavior of edge scrolling using both edges at the same time is undefined.
|
||||||
|
|
||||||
|
-Edge scrolling conflicts with @ref clickpad_softbuttons and is
|
||||||
|
-not usually available on clickpads. See
|
||||||
|
-http://who-t.blogspot.com.au/2015/03/why-libinput-doesnt-support-edge.html
|
||||||
|
-for details.
|
||||||
|
+Edge scrolling overlaps with @ref clickpad_softbuttons. A physical click on
|
||||||
|
+a clickpad ends scrolling.
|
||||||
|
|
||||||
|
@section button_scrolling On-Button scrolling
|
||||||
|
|
||||||
|
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
|
||||||
|
index 9c1c096..6def0c1 100644
|
||||||
|
--- a/src/evdev-mt-touchpad-buttons.c
|
||||||
|
+++ b/src/evdev-mt-touchpad-buttons.c
|
||||||
|
@@ -943,6 +943,10 @@ tp_notify_clickpadbutton(struct tp_dispatch *tp,
|
||||||
|
if (tp->device->suspended)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
+ /* A button click always terminates edge scrolling, even if we
|
||||||
|
+ * don't end up sending a button event. */
|
||||||
|
+ tp_edge_scroll_stop_events(tp, time);
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* If the user has requested clickfinger replace the button chosen
|
||||||
|
* by the softbutton code with one based on the number of fingers.
|
||||||
|
diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c
|
||||||
|
index 9a9d3b8..4d5f47a 100644
|
||||||
|
--- a/src/evdev-mt-touchpad-edge-scroll.c
|
||||||
|
+++ b/src/evdev-mt-touchpad-edge-scroll.c
|
||||||
|
@@ -34,7 +34,6 @@
|
||||||
|
|
||||||
|
#define CASE_RETURN_STRING(a) case a: return #a
|
||||||
|
|
||||||
|
-#define DEFAULT_SCROLL_LOCK_TIMEOUT 300 /* ms */
|
||||||
|
/* Use a reasonably large threshold until locked into scrolling mode, to
|
||||||
|
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
|
||||||
|
@@ -92,6 +91,23 @@ tp_touch_get_edge(struct tp_dispatch *tp, struct tp_touch *t)
|
||||||
|
return edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline void
|
||||||
|
+tp_edge_scroll_set_timer(struct tp_dispatch *tp,
|
||||||
|
+ struct tp_touch *t)
|
||||||
|
+{
|
||||||
|
+ const int DEFAULT_SCROLL_LOCK_TIMEOUT = 300; /* ms */
|
||||||
|
+ /* if we use software buttons, we disable timeout-based
|
||||||
|
+ * edge scrolling. A finger resting on the button areas is
|
||||||
|
+ * likely there to trigger a button event.
|
||||||
|
+ */
|
||||||
|
+ if (tp->buttons.click_method ==
|
||||||
|
+ LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ libinput_timer_set(&t->scroll.timer,
|
||||||
|
+ t->millis + DEFAULT_SCROLL_LOCK_TIMEOUT);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
tp_edge_scroll_set_state(struct tp_dispatch *tp,
|
||||||
|
struct tp_touch *t,
|
||||||
|
@@ -108,8 +124,7 @@ tp_edge_scroll_set_state(struct tp_dispatch *tp,
|
||||||
|
case EDGE_SCROLL_TOUCH_STATE_EDGE_NEW:
|
||||||
|
t->scroll.edge = tp_touch_get_edge(tp, t);
|
||||||
|
t->scroll.initial = t->point;
|
||||||
|
- libinput_timer_set(&t->scroll.timer,
|
||||||
|
- t->millis + DEFAULT_SCROLL_LOCK_TIMEOUT);
|
||||||
|
+ tp_edge_scroll_set_timer(tp, t);
|
||||||
|
break;
|
||||||
|
case EDGE_SCROLL_TOUCH_STATE_EDGE:
|
||||||
|
break;
|
||||||
|
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
|
||||||
|
index 2474340..2919267 100644
|
||||||
|
--- a/src/evdev-mt-touchpad.c
|
||||||
|
+++ b/src/evdev-mt-touchpad.c
|
||||||
|
@@ -1350,14 +1350,11 @@ tp_scroll_config_scroll_method_get_methods(struct libinput_device *device)
|
||||||
|
{
|
||||||
|
struct evdev_device *evdev = (struct evdev_device*)device;
|
||||||
|
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
|
||||||
|
- uint32_t methods = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
|
||||||
|
+ uint32_t methods = LIBINPUT_CONFIG_SCROLL_EDGE;
|
||||||
|
|
||||||
|
if (tp->ntouches >= 2)
|
||||||
|
methods |= LIBINPUT_CONFIG_SCROLL_2FG;
|
||||||
|
|
||||||
|
- if (!tp->buttons.is_clickpad)
|
||||||
|
- methods |= LIBINPUT_CONFIG_SCROLL_EDGE;
|
||||||
|
-
|
||||||
|
return methods;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/test/touchpad.c b/test/touchpad.c
|
||||||
|
index 4eed097..1e51eb2 100644
|
||||||
|
--- a/test/touchpad.c
|
||||||
|
+++ b/test/touchpad.c
|
||||||
|
@@ -1490,6 +1490,42 @@ START_TEST(touchpad_edge_scroll)
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
+START_TEST(touchpad_scroll_defaults)
|
||||||
|
+{
|
||||||
|
+ struct litest_device *dev = litest_current_device();
|
||||||
|
+ struct libinput_device *device = dev->libinput_device;
|
||||||
|
+ struct libevdev *evdev = dev->evdev;
|
||||||
|
+ enum libinput_config_scroll_method method, expected;
|
||||||
|
+ enum libinput_config_status status;
|
||||||
|
+
|
||||||
|
+ method = libinput_device_config_scroll_get_methods(device);
|
||||||
|
+ ck_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE);
|
||||||
|
+ if (libevdev_get_num_slots(evdev) > 1)
|
||||||
|
+ ck_assert(method & LIBINPUT_CONFIG_SCROLL_2FG);
|
||||||
|
+
|
||||||
|
+ if (libevdev_get_num_slots(evdev) > 1)
|
||||||
|
+ expected = LIBINPUT_CONFIG_SCROLL_2FG;
|
||||||
|
+ else
|
||||||
|
+ expected = LIBINPUT_CONFIG_SCROLL_EDGE;
|
||||||
|
+
|
||||||
|
+ method = libinput_device_config_scroll_get_method(device);
|
||||||
|
+ ck_assert_int_eq(method, expected);
|
||||||
|
+ method = libinput_device_config_scroll_get_default_method(device);
|
||||||
|
+ ck_assert_int_eq(method, expected);
|
||||||
|
+
|
||||||
|
+ status = libinput_device_config_scroll_set_method(device,
|
||||||
|
+ LIBINPUT_CONFIG_SCROLL_EDGE);
|
||||||
|
+ ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ status = libinput_device_config_scroll_set_method(device,
|
||||||
|
+ LIBINPUT_CONFIG_SCROLL_2FG);
|
||||||
|
+
|
||||||
|
+ if (libevdev_get_num_slots(evdev) > 1)
|
||||||
|
+ ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
+ else
|
||||||
|
+ ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
||||||
|
+}
|
||||||
|
+END_TEST
|
||||||
|
+
|
||||||
|
START_TEST(touchpad_edge_scroll_timeout)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
@@ -1639,6 +1675,164 @@ START_TEST(touchpad_edge_scroll_no_2fg)
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
+START_TEST(touchpad_edge_scroll_into_buttonareas)
|
||||||
|
+{
|
||||||
|
+ struct litest_device *dev = litest_current_device();
|
||||||
|
+ struct libinput *li = dev->libinput;
|
||||||
|
+
|
||||||
|
+ enable_buttonareas(dev);
|
||||||
|
+ enable_edge_scroll(dev);
|
||||||
|
+ litest_drain_events(li);
|
||||||
|
+
|
||||||
|
+ litest_touch_down(dev, 0, 99, 40);
|
||||||
|
+ litest_touch_move_to(dev, 0, 99, 40, 99, 95, 10, 0);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+ /* in the button zone now, make sure we still get events */
|
||||||
|
+ litest_touch_move_to(dev, 0, 99, 95, 99, 100, 10, 0);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+
|
||||||
|
+ /* and out of the zone again */
|
||||||
|
+ litest_touch_move_to(dev, 0, 99, 100, 99, 70, 10, 0);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+
|
||||||
|
+ /* still out of the zone */
|
||||||
|
+ litest_touch_move_to(dev, 0, 99, 70, 99, 50, 10, 0);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+}
|
||||||
|
+END_TEST
|
||||||
|
+
|
||||||
|
+START_TEST(touchpad_edge_scroll_within_buttonareas)
|
||||||
|
+{
|
||||||
|
+ struct litest_device *dev = litest_current_device();
|
||||||
|
+ struct libinput *li = dev->libinput;
|
||||||
|
+
|
||||||
|
+ enable_buttonareas(dev);
|
||||||
|
+ enable_edge_scroll(dev);
|
||||||
|
+ litest_drain_events(li);
|
||||||
|
+
|
||||||
|
+ litest_touch_down(dev, 0, 20, 99);
|
||||||
|
+
|
||||||
|
+ /* within left button */
|
||||||
|
+ litest_touch_move_to(dev, 0, 20, 99, 40, 99, 10, 0);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+
|
||||||
|
+ /* over to right button */
|
||||||
|
+ litest_touch_move_to(dev, 0, 40, 99, 60, 99, 10, 0);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+
|
||||||
|
+ /* within right button */
|
||||||
|
+ litest_touch_move_to(dev, 0, 60, 99, 80, 99, 10, 0);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+}
|
||||||
|
+END_TEST
|
||||||
|
+
|
||||||
|
+START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll)
|
||||||
|
+{
|
||||||
|
+ struct litest_device *dev = litest_current_device();
|
||||||
|
+ struct libinput *li = dev->libinput;
|
||||||
|
+ struct libinput_event *event;
|
||||||
|
+ struct libinput_event_pointer *ptrev;
|
||||||
|
+ double val;
|
||||||
|
+
|
||||||
|
+ enable_buttonareas(dev);
|
||||||
|
+ enable_edge_scroll(dev);
|
||||||
|
+ litest_drain_events(li);
|
||||||
|
+
|
||||||
|
+ litest_touch_down(dev, 0, 20, 95);
|
||||||
|
+ litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10, 5);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+
|
||||||
|
+ litest_button_click(dev, BTN_LEFT, true);
|
||||||
|
+ libinput_dispatch(li);
|
||||||
|
+
|
||||||
|
+ event = libinput_get_event(li);
|
||||||
|
+ ptrev = litest_is_axis_event(event,
|
||||||
|
+ LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
|
||||||
|
+ LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
|
||||||
|
+ val = libinput_event_pointer_get_axis_value(ptrev,
|
||||||
|
+ LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
|
||||||
|
+ ck_assert(val == 0.0);
|
||||||
|
+ libinput_event_destroy(event);
|
||||||
|
+
|
||||||
|
+ event = libinput_get_event(li);
|
||||||
|
+ ptrev = litest_is_button_event(event,
|
||||||
|
+ BTN_RIGHT,
|
||||||
|
+ LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
+
|
||||||
|
+ libinput_event_destroy(event);
|
||||||
|
+
|
||||||
|
+ /* within button areas -> no movement */
|
||||||
|
+ litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10, 0);
|
||||||
|
+ litest_assert_empty_queue(li);
|
||||||
|
+
|
||||||
|
+ litest_button_click(dev, BTN_LEFT, false);
|
||||||
|
+
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_BUTTON);
|
||||||
|
+
|
||||||
|
+ litest_touch_up(dev, 0);
|
||||||
|
+}
|
||||||
|
+END_TEST
|
||||||
|
+
|
||||||
|
+START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll)
|
||||||
|
+{
|
||||||
|
+ struct litest_device *dev = litest_current_device();
|
||||||
|
+ struct libinput *li = dev->libinput;
|
||||||
|
+ struct libinput_event *event;
|
||||||
|
+ struct libinput_event_pointer *ptrev;
|
||||||
|
+ double val;
|
||||||
|
+
|
||||||
|
+ enable_clickfinger(dev);
|
||||||
|
+ enable_edge_scroll(dev);
|
||||||
|
+ litest_drain_events(li);
|
||||||
|
+
|
||||||
|
+ litest_touch_down(dev, 0, 20, 95);
|
||||||
|
+ litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10, 5);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
+
|
||||||
|
+ litest_button_click(dev, BTN_LEFT, true);
|
||||||
|
+ libinput_dispatch(li);
|
||||||
|
+
|
||||||
|
+ event = libinput_get_event(li);
|
||||||
|
+ ptrev = litest_is_axis_event(event,
|
||||||
|
+ LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
|
||||||
|
+ LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
|
||||||
|
+ val = libinput_event_pointer_get_axis_value(ptrev,
|
||||||
|
+ LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
|
||||||
|
+ ck_assert(val == 0.0);
|
||||||
|
+ libinput_event_destroy(event);
|
||||||
|
+
|
||||||
|
+ event = libinput_get_event(li);
|
||||||
|
+ ptrev = litest_is_button_event(event,
|
||||||
|
+ BTN_LEFT,
|
||||||
|
+ LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
+
|
||||||
|
+ libinput_event_destroy(event);
|
||||||
|
+
|
||||||
|
+ /* clickfinger releases pointer -> expect movement */
|
||||||
|
+ litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10, 0);
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_MOTION);
|
||||||
|
+ litest_assert_empty_queue(li);
|
||||||
|
+
|
||||||
|
+ litest_button_click(dev, BTN_LEFT, false);
|
||||||
|
+
|
||||||
|
+ litest_assert_only_typed_events(li,
|
||||||
|
+ LIBINPUT_EVENT_POINTER_BUTTON);
|
||||||
|
+
|
||||||
|
+ litest_touch_up(dev, 0);
|
||||||
|
+}
|
||||||
|
+END_TEST
|
||||||
|
+
|
||||||
|
static int
|
||||||
|
touchpad_has_palm_detect_size(struct litest_device *dev)
|
||||||
|
{
|
||||||
|
@@ -3522,12 +3716,17 @@ litest_setup_tests(void)
|
||||||
|
litest_add("touchpad:scroll", touchpad_scroll_natural_defaults, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
litest_add("touchpad:scroll", touchpad_scroll_natural_enable_config, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
litest_add("touchpad:scroll", touchpad_scroll_natural, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||||
|
- litest_add("touchpad:scroll", touchpad_edge_scroll, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||||
|
- litest_add("touchpad:scroll", touchpad_edge_scroll_no_motion, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||||
|
- litest_add("touchpad:scroll", touchpad_edge_scroll_no_edge_after_motion, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||||
|
- litest_add("touchpad:scroll", touchpad_edge_scroll_timeout, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||||
|
- litest_add("touchpad:scroll", touchpad_edge_scroll_source, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||||
|
- litest_add("touchpad:scroll", touchpad_edge_scroll_no_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD);
|
||||||
|
+ litest_add("touchpad:scroll", touchpad_scroll_defaults, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
+ litest_add("touchpad:scroll", touchpad_edge_scroll, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
+ litest_add("touchpad:scroll", touchpad_edge_scroll_no_motion, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
+ litest_add("touchpad:scroll", touchpad_edge_scroll_no_edge_after_motion, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
+ litest_add("touchpad:scroll", touchpad_edge_scroll_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
+ litest_add("touchpad:scroll", touchpad_edge_scroll_source, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
+ litest_add("touchpad:scroll", touchpad_edge_scroll_no_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||||
|
+ litest_add("touchpad:scroll", touchpad_edge_scroll_into_buttonareas, LITEST_CLICKPAD, LITEST_ANY);
|
||||||
|
+ 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:palm", touchpad_palm_detect_at_edge, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
litest_add("touchpad:palm", touchpad_palm_detect_at_bottom_corners, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||||
|
--
|
||||||
|
2.4.3
|
||||||
|
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
Name: libinput
|
Name: libinput
|
||||||
Version: 0.19.0
|
Version: 0.19.0
|
||||||
Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
|
Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
|
||||||
Summary: Input device library
|
Summary: Input device library
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -18,6 +18,10 @@ Source2: commitid
|
|||||||
Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz
|
Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
Patch01: 0001-test-move-enable_edge_scroll-up.patch
|
||||||
|
Patch02: 0002-test-add-helper-function-for-enabling-click-methods.patch
|
||||||
|
Patch03: 0003-touchpad-allow-edge-scrolling-on-clickpads.patch
|
||||||
|
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: autoconf automake libtool pkgconfig
|
BuildRequires: autoconf automake libtool pkgconfig
|
||||||
BuildRequires: libevdev-devel
|
BuildRequires: libevdev-devel
|
||||||
@ -94,6 +98,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jul 09 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.19.0-2
|
||||||
|
- enable edge scrolling on clickpads (#1225579)
|
||||||
|
|
||||||
* Mon Jul 06 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.19.0-1
|
* Mon Jul 06 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.19.0-1
|
||||||
- libinput 0.19.0
|
- libinput 0.19.0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user