From: Peter Hutterer Date: Mon, 20 Apr 2015 06:09:31 +0000 (+1000) Subject: touchpad: switch from is_palm to an enum X-Git-Tag: upstream/0.15.0+92+gec468e8~56 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d288eb0a63793ebb64de041960336d6fb57060b0;p=platform%2Fupstream%2Flibinput.git 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 Reviewed-by: Hans de Goede --- diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 79177fb0..d8b44fa6 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -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; } diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index f602359f..ba65e413 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -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;