summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2023-03-17 13:08:31 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2023-03-30 05:53:23 +0000
commit898f80fa37c0085570c27786d427876520237762 (patch)
treeb834e488f92f65b7d247ba96b10da95a7b64fc2a /test
parentc26c05b255d51e344e07704aaae47c4150e9537f (diff)
downloadlibinput-898f80fa37c0085570c27786d427876520237762.tar.gz
tablet: always enable touch arbitration with touchscreens/ext. touchpads
Right now for touch arbitration to work, we require the device group to be the same (i.e. they're hanging off the same physical bus). That's not always the case and statistically we have a lot more devices that have a built-in tablet + touchscreen than we have Intuos-like external tablets. So let's default to the more common case - enabling arbitration with the first touchscreen/external touchpad we find. If a subsequent device is "better", swap it out. Right now, the only heuristic we have here is the device group check but in the future we could get more precise. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r--test/test-tablet.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test-tablet.c b/test/test-tablet.c
index 5a92ea6e..9a6602e6 100644
--- a/test/test-tablet.c
+++ b/test/test-tablet.c
@@ -5338,6 +5338,34 @@ START_TEST(touch_arbitration_late_touch_lift)
}
END_TEST
+START_TEST(touch_arbitration_swap_device)
+{
+ struct litest_device *tablet = litest_current_device();
+ struct libinput *li = tablet->libinput;
+
+ enum litest_device_type paired = paired_device(tablet);
+ if (paired == LITEST_NO_DEVICE)
+ return;
+
+ /* First, add a normal touchscreen */
+ struct litest_device *touchscreen = litest_add_device(li, LITEST_GENERIC_MULTITOUCH_SCREEN);
+ libinput_device_config_gesture_set_hold_enabled(touchscreen->libinput_device,
+ LIBINPUT_CONFIG_HOLD_DISABLED);
+ litest_drain_events(li);
+ assert_touch_is_arbitrated(tablet, touchscreen);
+
+ /* Now add a better device to override the pairing */
+ struct litest_device *finger = litest_add_device(li, paired);
+ libinput_device_config_gesture_set_hold_enabled(finger->libinput_device,
+ LIBINPUT_CONFIG_HOLD_DISABLED);
+ litest_drain_events(li);
+ assert_touch_is_arbitrated(tablet, finger);
+
+ litest_delete_device(touchscreen);
+ litest_delete_device(finger);
+}
+END_TEST
+
#if HAVE_LIBWACOM
static void
verify_left_handed_tablet_motion(struct litest_device *tablet,
@@ -6209,6 +6237,7 @@ TEST_COLLECTION(tablet)
litest_add(touch_arbitration_late_touch_lift, LITEST_TABLET, LITEST_ANY);
litest_add(touch_arbitration_outside_rect, LITEST_TABLET | LITEST_DIRECT, LITEST_ANY);
litest_add(touch_arbitration_remove_after, LITEST_TABLET | LITEST_DIRECT, LITEST_ANY);
+ litest_add(touch_arbitration_swap_device, LITEST_TABLET, LITEST_ANY);
litest_add_ranged(tablet_rotation_left_handed, LITEST_TABLET, LITEST_ANY, &lh_transitions);
litest_add_ranged(tablet_rotation_left_handed_configuration, LITEST_TABLET, LITEST_ANY, &lh_transitions);