mirror of
https://github.com/X11Libre/xf86-input-synaptics.git
synced 2026-03-24 01:34:04 +00:00
Don't assume that touch devices report per finger width and pressure
The palm detection relies on both the width and the pressure.
a897147be0 ("Use ABS_MT events for the palm detection when supported")
assumed that all the touch devices can report both ABS_MT_TOUCH_MAJOR
and ABS_MT_PRESSURE, but this is not necessarily true. This assumption
could hence break the palm detection when at least one of the mentioned
events is not declared but both ABS_TOOL_WIDTH and ABS_PRESSURE are
reported.
Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Peter Hutterer
parent
a897147be0
commit
a05894d169
@@ -626,9 +626,11 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
|
||||
hw->cumulative_dx += ev->value - last_val;
|
||||
else if (ev->code == ABS_MT_POSITION_Y)
|
||||
hw->cumulative_dy += ev->value - last_val;
|
||||
else if (ev->code == ABS_MT_TOUCH_MAJOR)
|
||||
else if (ev->code == ABS_MT_TOUCH_MAJOR &&
|
||||
priv->has_mt_palm_detect)
|
||||
hw->fingerWidth = ev->value;
|
||||
else if (ev->code == ABS_MT_PRESSURE)
|
||||
else if (ev->code == ABS_MT_PRESSURE &&
|
||||
priv->has_mt_palm_detect)
|
||||
hw->z = ev->value;
|
||||
}
|
||||
|
||||
@@ -880,6 +882,10 @@ event_query_touch(InputInfoPtr pInfo)
|
||||
return;
|
||||
}
|
||||
|
||||
if (libevdev_has_event_code(dev, EV_ABS, ABS_MT_TOUCH_MAJOR) &&
|
||||
libevdev_has_event_code(dev, EV_ABS, ABS_MT_PRESSURE))
|
||||
priv->has_mt_palm_detect = TRUE;
|
||||
|
||||
axnum = 0;
|
||||
for (axis = ABS_MT_SLOT + 1; axis <= ABS_MT_MAX; axis++) {
|
||||
int axis_idx = axis - ABS_MT_TOUCH_MAJOR;
|
||||
|
||||
@@ -1829,7 +1829,7 @@ SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw)
|
||||
if ((hw->z > para->palm_min_z) && (hw->fingerWidth > para->palm_min_width))
|
||||
return FS_BLOCKED;
|
||||
|
||||
if (priv->has_touch)
|
||||
if (priv->has_mt_palm_detect)
|
||||
return finger;
|
||||
|
||||
if (hw->x == 0 || priv->finger_state == FS_UNTOUCHED)
|
||||
|
||||
@@ -310,6 +310,7 @@ struct _SynapticsPrivateRec {
|
||||
Bool has_width; /* device reports finger width */
|
||||
Bool has_scrollbuttons; /* device has physical scrollbuttons */
|
||||
Bool has_semi_mt; /* device is only semi-multitouch capable */
|
||||
Bool has_mt_palm_detect; /* device reports per finger width and pressure */
|
||||
|
||||
enum TouchpadModel model; /* The detected model */
|
||||
unsigned short id_vendor; /* vendor id */
|
||||
|
||||
Reference in New Issue
Block a user