[PATCH libinput 2/2] touchpad: enable palm detection on tablets' touchpads

Peter Hutterer peter.hutterer at who-t.net
Fri Feb 23 00:48:44 UTC 2018


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c            | 18 ++++++++++++------
 src/evdev.c                        |  8 ++++++++
 src/evdev.h                        |  1 +
 udev/90-libinput-model-quirks.hwdb |  4 ++++
 4 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 73600ee5..5e4a6c0f 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -2701,6 +2701,12 @@ tp_is_tpkb_combo_below(struct evdev_device *device)
 		layout == TPKBCOMBO_LAYOUT_BELOW;
 }
 
+static inline bool
+tp_is_tablet(struct evdev_device *device)
+{
+	return device->tags & EVDEV_TAG_TABLET_TOUCHPAD;
+}
+
 static void
 tp_init_dwt(struct tp_dispatch *tp,
 	    struct evdev_device *device)
@@ -2798,9 +2804,6 @@ tp_init_palmdetect_size(struct tp_dispatch *tp,
 	const char *prop;
 	int threshold;
 
-	if (!tp->touch_size.use_touch_size)
-		return;
-
 	prop = udev_device_get_property_value(device->udev_device,
 					      "LIBINPUT_ATTR_PALM_SIZE_THRESHOLD");
 	if (!prop)
@@ -2847,17 +2850,20 @@ tp_init_palmdetect(struct tp_dispatch *tp,
 	tp_init_palmdetect_arbitration(tp, device);
 
 	if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD &&
-	    !tp_is_tpkb_combo_below(device))
+	    !tp_is_tpkb_combo_below(device) &&
+	    !tp_is_tablet(device))
 		return;
 
-	tp->palm.monitor_trackpoint = true;
+	if (!tp_is_tablet(device))
+		tp->palm.monitor_trackpoint = true;
 
 	if (libevdev_has_event_code(device->evdev,
 				    EV_ABS,
 				    ABS_MT_TOOL_TYPE))
 		tp->palm.use_mt_tool = true;
 
-	tp_init_palmdetect_edge(tp, device);
+	if (!tp_is_tablet(device))
+		tp_init_palmdetect_edge(tp, device);
 	tp_init_palmdetect_pressure(tp, device);
 	tp_init_palmdetect_size(tp, device);
 }
diff --git a/src/evdev.c b/src/evdev.c
index 257824aa..5c979ed1 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -441,6 +441,12 @@ evdev_tag_keyboard(struct evdev_device *device,
 	device->tags |= EVDEV_TAG_KEYBOARD;
 }
 
+static void
+evdev_tag_tablet_touchpad(struct evdev_device *device)
+{
+	device->tags |= EVDEV_TAG_TABLET_TOUCHPAD;
+}
+
 static int
 evdev_calibration_has_matrix(struct libinput_device *libinput_device)
 {
@@ -1638,6 +1644,8 @@ evdev_configure_device(struct evdev_device *device)
 	}
 
 	if (udev_tags & EVDEV_UDEV_TAG_TOUCHPAD) {
+		if (udev_tags & EVDEV_UDEV_TAG_TABLET)
+			evdev_tag_tablet_touchpad(device);
 		dispatch = evdev_mt_touchpad_create(device);
 		evdev_log_info(device, "device is a touchpad\n");
 		return dispatch;
diff --git a/src/evdev.h b/src/evdev.h
index 162adecb..1e213296 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -72,6 +72,7 @@ enum evdev_device_tags {
 	EVDEV_TAG_INTERNAL_KEYBOARD = (1 << 6),
 	EVDEV_TAG_EXTERNAL_KEYBOARD = (1 << 7),
 	EVDEV_TAG_TABLET_MODE_SWITCH = (1 << 8),
+	EVDEV_TAG_TABLET_TOUCHPAD = (1 << 9),
 };
 
 enum evdev_middlebutton_state {
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index e8e3f43c..b6d2361d 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -280,6 +280,10 @@ libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnSystem76*pvrkudp1*
 libinput:touchpad:input:b0003v056Ap*
  LIBINPUT_MODEL_WACOM_TOUCHPAD=1
 
+# Wacom Intuos Pro PTH-660
+libinput:touchpad:input:b0003v056Ap0357*
+ LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=5
+
 ##########################################
 # Anything that has trackball in the name
 ##########################################
-- 
2.14.3



More information about the wayland-devel mailing list