mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-22 03:20:35 +01:00
touchpad: add a helper function for counting touches for gestures
Currently the same as tp_touch_active() but this will change. No functional changes. Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6e27a100b5
commit
7c9ed03c42
3 changed files with 18 additions and 3 deletions
|
|
@ -55,7 +55,7 @@ tp_get_touches_delta(struct tp_dispatch *tp, bool average)
|
|||
for (i = 0; i < tp->num_slots; i++) {
|
||||
t = &tp->touches[i];
|
||||
|
||||
if (!tp_touch_active(tp, t))
|
||||
if (!tp_touch_active_for_gesture(tp, t))
|
||||
continue;
|
||||
|
||||
nactive++;
|
||||
|
|
@ -174,7 +174,7 @@ tp_gesture_get_active_touches(const struct tp_dispatch *tp,
|
|||
memset(touches, 0, count * sizeof(struct tp_touch *));
|
||||
|
||||
tp_for_each_touch(tp, t) {
|
||||
if (tp_touch_active(tp, t)) {
|
||||
if (tp_touch_active_for_gesture(tp, t)) {
|
||||
touches[n++] = t;
|
||||
if (n == count)
|
||||
return count;
|
||||
|
|
@ -758,7 +758,7 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time)
|
|||
struct tp_touch *t;
|
||||
|
||||
tp_for_each_touch(tp, t) {
|
||||
if (tp_touch_active(tp, t))
|
||||
if (tp_touch_active_for_gesture(tp, t))
|
||||
active_touches++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -779,6 +779,17 @@ tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t)
|
|||
tp_edge_scroll_touch_active(tp, t);
|
||||
}
|
||||
|
||||
bool
|
||||
tp_touch_active_for_gesture(const struct tp_dispatch *tp, const struct tp_touch *t)
|
||||
{
|
||||
return (t->state == TOUCH_BEGIN || t->state == TOUCH_UPDATE) &&
|
||||
t->palm.state == PALM_NONE &&
|
||||
!t->pinned.is_pinned &&
|
||||
!tp_thumb_ignored(tp, t) &&
|
||||
tp_button_touch_active(tp, t) &&
|
||||
tp_edge_scroll_touch_active(tp, t);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
tp_palm_was_in_side_edge(const struct tp_dispatch *tp, const struct tp_touch *t)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -569,6 +569,10 @@ tp_filter_motion_unaccelerated(struct tp_dispatch *tp,
|
|||
bool
|
||||
tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t);
|
||||
|
||||
bool
|
||||
tp_touch_active_for_gesture(const struct tp_dispatch *tp,
|
||||
const struct tp_touch *t);
|
||||
|
||||
int
|
||||
tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue