mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-28 10:50:07 +01:00
touchpad: switch from is_palm to an enum
Preparation to add different palm detection types. Not all of them need to be un-done when leaving the edge area so a boolean is not enough. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
46171fbef3
commit
d288eb0a63
2 changed files with 11 additions and 6 deletions
|
|
@ -231,7 +231,7 @@ tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
|||
}
|
||||
|
||||
t->dirty = true;
|
||||
t->palm.is_palm = false;
|
||||
t->palm.state = PALM_NONE;
|
||||
t->state = TOUCH_END;
|
||||
t->pinned.is_pinned = false;
|
||||
t->millis = time;
|
||||
|
|
@ -455,7 +455,7 @@ int
|
|||
tp_touch_active(struct tp_dispatch *tp, struct tp_touch *t)
|
||||
{
|
||||
return (t->state == TOUCH_BEGIN || t->state == TOUCH_UPDATE) &&
|
||||
!t->palm.is_palm &&
|
||||
t->palm.state == PALM_NONE &&
|
||||
!t->pinned.is_pinned &&
|
||||
tp_button_touch_active(tp, t) &&
|
||||
tp_edge_scroll_touch_active(tp, t);
|
||||
|
|
@ -491,14 +491,14 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
|||
we move out of the palm edge zone within the timeout, provided
|
||||
the direction is within 45 degrees of the horizontal.
|
||||
*/
|
||||
if (t->palm.is_palm) {
|
||||
if (t->palm.state == PALM_EDGE) {
|
||||
if (time < t->palm.time + PALM_TIMEOUT &&
|
||||
(t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge)) {
|
||||
delta = device_delta(t->point, t->palm.first);
|
||||
dirs = normalized_get_direction(
|
||||
tp_normalize_delta(tp, delta));
|
||||
if ((dirs & DIRECTIONS) && !(dirs & ~DIRECTIONS)) {
|
||||
t->palm.is_palm = false;
|
||||
t->palm.state = PALM_NONE;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
@ -517,7 +517,7 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
|
|||
tp_button_is_inside_softbutton_area(tp, t))
|
||||
return;
|
||||
|
||||
t->palm.is_palm = true;
|
||||
t->palm.state = PALM_EDGE;
|
||||
t->palm.time = time;
|
||||
t->palm.first = t->point;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,11 @@ enum touch_state {
|
|||
TOUCH_END
|
||||
};
|
||||
|
||||
enum touch_palm_state {
|
||||
PALM_NONE = 0,
|
||||
PALM_EDGE,
|
||||
};
|
||||
|
||||
enum button_event {
|
||||
BUTTON_EVENT_IN_BOTTOM_R = 30,
|
||||
BUTTON_EVENT_IN_BOTTOM_L,
|
||||
|
|
@ -171,7 +176,7 @@ struct tp_touch {
|
|||
} scroll;
|
||||
|
||||
struct {
|
||||
bool is_palm;
|
||||
enum touch_palm_state state;
|
||||
struct device_coords first; /* first coordinates if is_palm == true */
|
||||
uint32_t time; /* first timestamp if is_palm == true */
|
||||
} palm;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue