touchpad: enable palm detection on tablets' touchpads

https://bugs.freedesktop.org/show_bug.cgi?id=104986

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-02-09 12:17:38 +10:00
parent b1ddd1effe
commit a437d9374b
4 changed files with 25 additions and 6 deletions

View file

@ -2788,6 +2788,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)
@ -2885,9 +2891,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)
@ -2934,17 +2937,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);
}

View file

@ -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;

View file

@ -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 {

View file

@ -282,6 +282,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
##########################################