'test/litest-device-synaptics-st.c',
'test/litest-device-synaptics-t440.c',
'test/litest-device-synaptics-x1-carbon-3rd.c',
+ 'test/litest-device-synaptics-phantomclicks.c',
'test/litest-device-tablet-mode-switch.c',
'test/litest-device-thinkpad-extrabuttons.c',
'test/litest-device-trackpoint.c',
MatchName=* Touchpad
MatchDMIModalias=dmi:*svnDellInc.:pnXPS159500:*
ModelTouchpadVisibleMarker=0
+ModelTouchpadPhantomClicks=1
[Dell Latitude D620 Trackpoint]
MatchName=*DualPoint Stick
struct tp_touch *t;
uint32_t area = 0;
+ if (evdev_device_has_model_quirk(tp->device,
+ QUIRK_MODEL_TOUCHPAD_PHANTOM_CLICKS) &&
+ tp->nactive_slots == 0) {
+ /* Some touchpads, notably those on the Dell XPS 15 9500,
+ * are prone to registering touchpad clicks when the
+ * case is sufficiently flexed. Ignore these by
+ * disregarding any clicks that are registered without
+ * touchpad touch. */
+ tp->buttons.click_pending = true;
+ return 0;
+ }
+
tp_for_each_touch(tp, t) {
switch (t->button.current) {
case BUTTON_EVENT_IN_AREA:
case QUIRK_MODEL_TABLET_MODE_NO_SUSPEND: return "ModelTabletModeNoSuspend";
case QUIRK_MODEL_TABLET_MODE_SWITCH_UNRELIABLE: return "ModelTabletModeSwitchUnreliable";
case QUIRK_MODEL_TOUCHPAD_VISIBLE_MARKER: return "ModelTouchpadVisibleMarker";
+ case QUIRK_MODEL_TOUCHPAD_PHANTOM_CLICKS: return "ModelTouchpadPhantomClicks";
case QUIRK_MODEL_TRACKBALL: return "ModelTrackball";
case QUIRK_MODEL_WACOM_TOUCHPAD: return "ModelWacomTouchpad";
case QUIRK_MODEL_PRESSURE_PAD: return "ModelPressurePad";
QUIRK_MODEL_TRACKBALL,
QUIRK_MODEL_WACOM_TOUCHPAD,
QUIRK_MODEL_PRESSURE_PAD,
+ QUIRK_MODEL_TOUCHPAD_PHANTOM_CLICKS,
_QUIRK_LAST_MODEL_QUIRK_, /* Guard: do not modify */
--- /dev/null
+/*
+ * Copyright © 2023 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include "litest.h"
+#include "litest-int.h"
+
+static struct input_event down[] = {
+ { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+ { .type = -1, .code = -1 },
+};
+
+static struct input_event move[] = {
+ { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
+ { .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
+ { .type = -1, .code = -1 },
+};
+
+static struct litest_device_interface interface = {
+ .touch_down_events = down,
+ .touch_move_events = move,
+};
+
+static struct input_id input_id = {
+ .bustype = 0x18,
+ .vendor = 0x4f3,
+ .product = 0x311c,
+};
+
+static int events[] = {
+ EV_KEY, BTN_LEFT,
+ EV_KEY, BTN_TOOL_FINGER,
+ EV_KEY, BTN_TOUCH,
+ EV_KEY, BTN_TOOL_DOUBLETAP,
+ EV_KEY, BTN_TOOL_TRIPLETAP,
+ EV_KEY, BTN_TOOL_QUADTAP,
+ EV_KEY, BTN_TOOL_QUINTTAP,
+ INPUT_PROP_MAX, INPUT_PROP_POINTER,
+ INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD,
+ -1, -1,
+};
+
+static struct input_absinfo absinfo[] = {
+ { ABS_X, 0, 4654, 0, 0, 31 },
+ { ABS_Y, 0, 2730, 0, 0, 31 },
+ { ABS_MT_SLOT, 0, 4, 0, 0, 0 },
+ { ABS_MT_POSITION_X, 0, 4654, 0, 0, 31 },
+ { ABS_MT_POSITION_Y, 0, 2730, 0, 0, 31 },
+ { ABS_MT_TOOL_TYPE, 0, 2, 0, 0, 0 },
+ { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 },
+ { .value = -1 }
+};
+
+static const char quirk_file[] =
+"[litest Dell XPS 15 9500 Touchpad]\n"
+"MatchName=litest DELL097D:00 04F3:311C Touchpad\n"
+"ModelTouchpadVisibleMarker=0\n"
+"ModelTouchpadPhantomClicks=1\n";
+
+TEST_DEVICE("synaptics-phantomclicks",
+ .type = LITEST_SYNAPTICS_PHANTOMCLICKS,
+ .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON,
+ .interface = &interface,
+ .name = "DELL097D:00 04F3:311C Touchpad",
+ .id = &input_id,
+ .events = events,
+ .absinfo = absinfo,
+ .quirk_file = quirk_file,
+)
LITEST_WACOM_ISDV4_524C_PEN,
LITEST_MOUSE_FORMAT_STRING,
LITEST_LENOVO_SCROLLPOINT,
+ LITEST_SYNAPTICS_PHANTOMCLICKS,
};
#define LITEST_DEVICELESS -2
ck_assert_int_eq(rc, 0);
/* This matches the current set of test devices but may fail if
* newer ones are added */
- ck_assert_double_gt(w, 40);
+ ck_assert_double_gt(w, 30);
ck_assert_double_gt(h, 20);
}
END_TEST
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
+ if (dev->which == LITEST_SYNAPTICS_PHANTOMCLICKS) {
+ /* The XPS 15 9500 touchpad has the ModelTouchpadPhantomClicks
+ * quirk enabled and doesn't generate events without touches. */
+ return;
+ }
+
litest_enable_clickfinger(dev);
litest_drain_events(li);
}
END_TEST
+START_TEST(touchpad_1fg_clickfinger_no_touch_phantomclicks)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput *li = dev->libinput;
+
+ litest_enable_clickfinger(dev);
+
+ litest_drain_events(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);
+
+ libinput_dispatch(li);
+
+ litest_assert_empty_queue(li);
+}
+END_TEST
+
START_TEST(touchpad_2fg_clickfinger)
{
struct litest_device *dev = litest_current_device();
litest_assert_empty_queue(li);
litest_touch_down(dev, 1, 20, 20);
- litest_touch_move_to(dev, 1, 20, 20, 80, 20, 10);
+ litest_touch_move_to(dev, 1, 20, 20, 80, 20, 15);
libinput_dispatch(li);
event = libinput_get_event(li);
/* second finger down */
litest_touch_down(dev, 1, 20, 20);
- litest_touch_move_to(dev, 1, 20, 20, 20, 80, 10);
+ litest_touch_move_to(dev, 1, 20, 20, 20, 80, 15);
libinput_dispatch(li);
event = libinput_get_event(li);
*/
litest_touch_down(dev, 0, 30, 90);
- litest_touch_move_to(dev, 0, 30, 90, 90, 90, 10);
+ litest_touch_move_to(dev, 0, 30, 90, 90, 90, 15);
litest_drain_events(li);
litest_event(dev, EV_KEY, BTN_LEFT, 1);
*/
litest_touch_down(dev, 0, 80, 90);
- litest_touch_move_to(dev, 0, 80, 90, 30, 90, 10);
+ litest_touch_move_to(dev, 0, 80, 90, 30, 90, 15);
litest_drain_events(li);
litest_event(dev, EV_KEY, BTN_LEFT, 1);
litest_add_for_device(touchpad_clickfinger_appletouch_2fg, LITEST_APPLETOUCH);
litest_add_for_device(touchpad_clickfinger_appletouch_3fg, LITEST_APPLETOUCH);
+ litest_add_for_device(touchpad_1fg_clickfinger_no_touch_phantomclicks, LITEST_SYNAPTICS_PHANTOMCLICKS);
+
litest_add_ranged(touchpad_clickfinger_click_drag, LITEST_CLICKPAD, LITEST_ANY, &finger_count);
litest_add(touchpad_click_defaults_clickfinger, LITEST_APPLE_CLICKPAD, LITEST_ANY);
litest_enable_edge_scroll(dev);
litest_touch_down(dev, 0, 20, 99);
- litest_touch_move_to(dev, 0, 20, 99, 70, 99, 10);
+ litest_touch_move_to(dev, 0, 20, 99, 70, 99, 15);
litest_touch_up(dev, 0);
libinput_dispatch(li);
litest_assert_empty_queue(li);
litest_touch_down(dev, 0, 70, 99);
- litest_touch_move_to(dev, 0, 70, 99, 20, 99, 10);
+ litest_touch_move_to(dev, 0, 70, 99, 20, 99, 15);
litest_touch_up(dev, 0);
libinput_dispatch(li);
litest_drain_events(li);
litest_touch_down(dev, 0, 20, 95);
- litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10);
+ litest_touch_move_to(dev, 0, 20, 95, 70, 95, 15);
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER);
litest_button_click(dev, BTN_LEFT, true);
* edge scrolling, click, then scrolling without lifting the finger
* is so small we'll let it pass.
*/
- litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10);
+ litest_touch_move_to(dev, 0, 70, 95, 90, 95, 15);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_button_click(dev, BTN_LEFT, false);
litest_drain_events(li);
litest_touch_down(dev, 0, 20, 95);
- litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10);
+ litest_touch_move_to(dev, 0, 20, 95, 70, 95, 15);
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER);
litest_button_click(dev, BTN_LEFT, true);
libinput_event_destroy(event);
/* clickfinger releases pointer -> expect movement */
- litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10);
+ litest_touch_move_to(dev, 0, 70, 95, 90, 95, 15);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_assert_empty_queue(li);
litest_drain_events(li);
litest_touch_down(dev, 0, 20, 1);
- litest_touch_move_to(dev, 0, 20, 1, 70, 1, 10);
+ litest_touch_move_to(dev, 0, 20, 1, 70, 1, 15);
litest_touch_up(dev, 0);
litest_assert_empty_queue(li);
litest_drain_events(li);
litest_touch_down(dev, 0, 99, 50);
- litest_touch_move_to(dev, 0, 99, 50, 0, 70, 20);
+ litest_touch_move_to(dev, 0, 99, 50, 0, 70, 25);
litest_touch_up(dev, 0);
libinput_dispatch(li);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
- litest_touch_move_to(dev, 0, 50, 50, 99, 50, 10);
+ litest_touch_move_to(dev, 0, 50, 50, 99, 50, 15);
litest_drain_events(li);
- litest_touch_move_to(dev, 0, 99, 50, 99, 90, 10);
+ litest_touch_move_to(dev, 0, 99, 50, 99, 90, 15);
libinput_dispatch(li);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
litest_drain_events(li);
litest_touch_down(dev, 0, 50, 50);
- litest_touch_move_to(dev, 0, 50, 50, 0, 2, 10);
+ litest_touch_move_to(dev, 0, 50, 50, 0, 2, 15);
litest_drain_events(li);
- litest_touch_move_to(dev, 0, 0, 2, 50, 50, 10);
+ litest_touch_move_to(dev, 0, 0, 2, 50, 50, 15);
libinput_dispatch(li);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);