mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 08:18:02 +02:00
touchpad: change palm detection trigger functions to bools
And rename to make it more obvious what the return value means. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
parent
3dac359df3
commit
bc84245ec3
1 changed files with 15 additions and 13 deletions
|
|
@ -573,15 +573,17 @@ tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
tp_palm_detect_dwt(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_palm_detect_dwt_triggered(struct tp_dispatch *tp,
|
||||||
|
struct tp_touch *t,
|
||||||
|
uint64_t time)
|
||||||
{
|
{
|
||||||
if (tp->dwt.dwt_enabled &&
|
if (tp->dwt.dwt_enabled &&
|
||||||
tp->dwt.keyboard_active &&
|
tp->dwt.keyboard_active &&
|
||||||
t->state == TOUCH_BEGIN) {
|
t->state == TOUCH_BEGIN) {
|
||||||
t->palm.state = PALM_TYPING;
|
t->palm.state = PALM_TYPING;
|
||||||
t->palm.first = t->point;
|
t->palm.first = t->point;
|
||||||
return 1;
|
return true;
|
||||||
} else if (!tp->dwt.keyboard_active &&
|
} else if (!tp->dwt.keyboard_active &&
|
||||||
t->state == TOUCH_UPDATE &&
|
t->state == TOUCH_UPDATE &&
|
||||||
t->palm.state == PALM_TYPING) {
|
t->palm.state == PALM_TYPING) {
|
||||||
|
|
@ -599,22 +601,22 @@ tp_palm_detect_dwt(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
tp_palm_detect_trackpoint(struct tp_dispatch *tp,
|
tp_palm_detect_trackpoint_triggered(struct tp_dispatch *tp,
|
||||||
struct tp_touch *t,
|
struct tp_touch *t,
|
||||||
uint64_t time)
|
uint64_t time)
|
||||||
{
|
{
|
||||||
if (!tp->palm.monitor_trackpoint)
|
if (!tp->palm.monitor_trackpoint)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
if (t->palm.state == PALM_NONE &&
|
if (t->palm.state == PALM_NONE &&
|
||||||
t->state == TOUCH_BEGIN &&
|
t->state == TOUCH_BEGIN &&
|
||||||
tp->palm.trackpoint_active) {
|
tp->palm.trackpoint_active) {
|
||||||
t->palm.state = PALM_TRACKPOINT;
|
t->palm.state = PALM_TRACKPOINT;
|
||||||
return 1;
|
return true;
|
||||||
} else if (t->palm.state == PALM_TRACKPOINT &&
|
} else if (t->palm.state == PALM_TRACKPOINT &&
|
||||||
t->state == TOUCH_UPDATE &&
|
t->state == TOUCH_UPDATE &&
|
||||||
!tp->palm.trackpoint_active) {
|
!tp->palm.trackpoint_active) {
|
||||||
|
|
@ -627,7 +629,7 @@ tp_palm_detect_trackpoint(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
|
|
@ -684,10 +686,10 @@ static void
|
||||||
tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (tp_palm_detect_dwt(tp, t, time))
|
if (tp_palm_detect_dwt_triggered(tp, t, time))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (tp_palm_detect_trackpoint(tp, t, time))
|
if (tp_palm_detect_trackpoint_triggered(tp, t, time))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (t->palm.state == PALM_EDGE) {
|
if (t->palm.state == PALM_EDGE) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue