summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-04-14 15:18:13 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-04-21 00:15:42 +0000
commit467266bbb4cd208ecf163a6461bad1e47b5e6872 (patch)
treefa35ea75de909b149641d93835b9b813609f3d8e /test
parent16d5d78a4d369286ec0136e0a4310ab0f4536add (diff)
touchpad: a touchpad with only one button is a clickpad
There is only one touchpad with a physical left button but no right button and that is the old Apple touchpad, discontinued in 2008. Not a huge number of those left, I assume. So let's change our assumptions because these days the vast majority of touchpads are clickpads - any touchpad that only has a left button is treated as clickpad, even where the kernel doesn't set the INPUT_PROP_BUTTONPAD. We do need to check for BTN_LEFT as well though, because Wacom touchpads (i.e. the touch part of non-integrated Wacom tablets) don't have a left button either. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r--test/test-touchpad-buttons.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/test-touchpad-buttons.c b/test/test-touchpad-buttons.c
index e0a8ddf2..6af571d9 100644
--- a/test/test-touchpad-buttons.c
+++ b/test/test-touchpad-buttons.c
@@ -2053,6 +2053,51 @@ START_TEST(clickpad_middleemulation_click_disable_while_down)
}
END_TEST
+START_TEST(touchpad_non_clickpad_detection)
+{
+ struct libinput *li;
+ struct libinput_device *device;
+ struct libevdev_uinput *uinput;
+ static struct input_absinfo absinfo[] = {
+ { ABS_X, 1472, 5472, 0, 0, 75 },
+ { ABS_Y, 1408, 4448, 0, 0, 129 },
+ { ABS_PRESSURE, 0, 255, 0, 0, 0 },
+ { ABS_TOOL_WIDTH, 0, 15, 0, 0, 0 },
+ { ABS_MT_SLOT, 0, 1, 0, 0, 0 },
+ { ABS_MT_POSITION_X, 1472, 5472, 0, 0, 75 },
+ { ABS_MT_POSITION_Y, 1408, 4448, 0, 0, 129 },
+ { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 },
+ { ABS_MT_PRESSURE, 0, 255, 0, 0, 0 },
+ { .value = -1 }
+ };
+ uint32_t methods;
+
+ /* Create a touchpad with only a left button but missing
+ * INPUT_PROP_BUTTONPAD. We should treat this as clickpad.
+ */
+ uinput = litest_create_uinput_abs_device("litest NonClickpad",
+ NULL,
+ absinfo,
+ EV_KEY, BTN_LEFT,
+ EV_KEY, BTN_TOOL_FINGER,
+ EV_KEY, BTN_TOUCH,
+ -1);
+
+ li = litest_create_context();
+ device = libinput_path_add_device(li,
+ libevdev_uinput_get_devnode(uinput));
+
+ methods = libinput_device_config_click_get_methods(device);
+ ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS);
+ ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER);
+
+
+ libinput_path_remove_device(device);
+ libevdev_uinput_destroy(uinput);
+ litest_destroy_context(li);
+}
+END_TEST
+
TEST_COLLECTION(touchpad_buttons)
{
struct range finger_count = {1, 4};
@@ -2122,4 +2167,6 @@ TEST_COLLECTION(touchpad_buttons)
litest_add(clickpad_middleemulation_click_middle_right, LITEST_CLICKPAD, LITEST_ANY);
litest_add(clickpad_middleemulation_click_enable_while_down, LITEST_CLICKPAD, LITEST_ANY);
litest_add(clickpad_middleemulation_click_disable_while_down, LITEST_CLICKPAD, LITEST_ANY);
+
+ litest_add_no_device(touchpad_non_clickpad_detection);
}