Commit 27c42990 authored by Matt Mayfield's avatar Matt Mayfield
Browse files

touchpad: fine tune size-based thumb detection

In testing on an Apple Magic Trackpad, thumb touches are reliably
detected by being quite large in the major dimension, but around
half the size in the minor dimension.
parent 66ac659e
Pipeline #3739 passed with stages
in 5 minutes and 40 seconds
...@@ -34,7 +34,7 @@ MatchProduct=0x030E ...@@ -34,7 +34,7 @@ MatchProduct=0x030E
AttrSizeHint=130x110 AttrSizeHint=130x110
AttrTouchSizeRange=20:10 AttrTouchSizeRange=20:10
AttrPalmSizeThreshold=900 AttrPalmSizeThreshold=900
AttrThumbSizeThreshold=800 AttrThumbSizeThreshold=700
[Apple Touchpad OneButton] [Apple Touchpad OneButton]
MatchUdevType=touchpad MatchUdevType=touchpad
......
...@@ -1133,16 +1133,17 @@ tp_thumb_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) ...@@ -1133,16 +1133,17 @@ tp_thumb_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
* a thumb. * a thumb.
*/ */
if (tp->thumb.use_pressure && if (tp->thumb.use_pressure &&
t->pressure > tp->thumb.pressure_threshold) t->pressure > tp->thumb.pressure_threshold) {
t->thumb.state = THUMB_STATE_YES; t->thumb.state = THUMB_STATE_YES;
else if (tp->thumb.use_size && } else if (tp->thumb.use_size &&
(t->major > tp->thumb.size_threshold || (t->major > tp->thumb.size_threshold) &&
t->minor > tp->thumb.size_threshold)) (t->minor < (tp->thumb.size_threshold * 0.6))) {
t->thumb.state = THUMB_STATE_YES; t->thumb.state = THUMB_STATE_YES;
else if (t->point.y > tp->thumb.lower_thumb_line && } else if (t->point.y > tp->thumb.lower_thumb_line &&
tp->scroll.method != LIBINPUT_CONFIG_SCROLL_EDGE && tp->scroll.method != LIBINPUT_CONFIG_SCROLL_EDGE &&
t->thumb.first_touch_time + THUMB_MOVE_TIMEOUT < time) t->thumb.first_touch_time + THUMB_MOVE_TIMEOUT < time) {
t->thumb.state = THUMB_STATE_YES; t->thumb.state = THUMB_STATE_YES;
}
/* now what? we marked it as thumb, so: /* now what? we marked it as thumb, so:
* *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment