mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-06 18:27:59 +02:00
touchpad: move edge palm detection into a helper too
Just code cleanup, no changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
60d3b6a8ed
commit
ddcf1f61bf
1 changed files with 27 additions and 14 deletions
|
|
@ -664,16 +664,11 @@ tp_palm_detect_multifinger(struct tp_dispatch *tp, struct tp_touch *t, uint64_t
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static inline bool
|
||||||
tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_palm_detect_edge(struct tp_dispatch *tp,
|
||||||
|
struct tp_touch *t,
|
||||||
|
uint64_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (tp_palm_detect_dwt_triggered(tp, t, time))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (tp_palm_detect_trackpoint_triggered(tp, t, time))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (t->palm.state == PALM_EDGE) {
|
if (t->palm.state == PALM_EDGE) {
|
||||||
if (tp_palm_detect_multifinger(tp, t, time)) {
|
if (tp_palm_detect_multifinger(tp, t, time)) {
|
||||||
t->palm.state = PALM_NONE;
|
t->palm.state = PALM_NONE;
|
||||||
|
|
@ -689,31 +684,49 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
evdev_log_debug(tp->device,
|
evdev_log_debug(tp->device,
|
||||||
"palm: touch released, out of edge zone\n");
|
"palm: touch released, out of edge zone\n");
|
||||||
}
|
}
|
||||||
return;
|
return false;
|
||||||
} else if (tp_palm_detect_multifinger(tp, t, time)) {
|
} else if (tp_palm_detect_multifinger(tp, t, time)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* palm must start in exclusion zone, it's ok to move into
|
/* palm must start in exclusion zone, it's ok to move into
|
||||||
the zone without being a palm */
|
the zone without being a palm */
|
||||||
if (t->state != TOUCH_BEGIN ||
|
if (t->state != TOUCH_BEGIN ||
|
||||||
(t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge))
|
(t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
/* don't detect palm in software button areas, it's
|
/* don't detect palm in software button areas, it's
|
||||||
likely that legitimate touches start in the area
|
likely that legitimate touches start in the area
|
||||||
covered by the exclusion zone */
|
covered by the exclusion zone */
|
||||||
if (tp->buttons.is_clickpad &&
|
if (tp->buttons.is_clickpad &&
|
||||||
tp_button_is_inside_softbutton_area(tp, t))
|
tp_button_is_inside_softbutton_area(tp, t))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (tp_touch_get_edge(tp, t) & EDGE_RIGHT)
|
if (tp_touch_get_edge(tp, t) & EDGE_RIGHT)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
t->palm.state = PALM_EDGE;
|
t->palm.state = PALM_EDGE;
|
||||||
t->palm.time = time;
|
t->palm.time = time;
|
||||||
t->palm.first = t->point;
|
t->palm.first = t->point;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (tp_palm_detect_dwt_triggered(tp, t, time))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (tp_palm_detect_trackpoint_triggered(tp, t, time))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (tp_palm_detect_edge(tp, t, time))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
evdev_log_debug(tp->device,
|
evdev_log_debug(tp->device,
|
||||||
"palm: palm detected (%s)\n",
|
"palm: palm detected (%s)\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue