Lines Matching refs:tp
50 tp_thumb_set_state(struct tp_dispatch *tp,
56 if (tp->thumb.state == state && tp->thumb.index == index)
59 evdev_log_debug(tp->device,
62 thumb_state_to_str(tp->thumb.state),
65 tp->thumb.state = state;
66 tp->thumb.index = index;
70 tp_thumb_reset(struct tp_dispatch *tp)
72 tp->thumb.state = THUMB_STATE_FINGER;
73 tp->thumb.index = UINT_MAX;
74 tp->thumb.pinch_eligible = true;
78 tp_thumb_lift(struct tp_dispatch *tp)
80 tp->thumb.state = THUMB_STATE_FINGER;
81 tp->thumb.index = UINT_MAX;
85 tp_thumb_in_exclusion_area(const struct tp_dispatch *tp,
88 return (t->point.y > tp->thumb.lower_thumb_line &&
89 tp->scroll.method != LIBINPUT_CONFIG_SCROLL_EDGE);
94 tp_thumb_detect_pressure_size(const struct tp_dispatch *tp,
99 if (tp->thumb.use_pressure &&
100 t->pressure > tp->thumb.pressure_threshold &&
101 tp_thumb_in_exclusion_area(tp, t)) {
105 if (tp->thumb.use_size &&
106 (t->major > tp->thumb.size_threshold) &&
107 (t->minor < (tp->thumb.size_threshold * 0.6))) {
115 tp_thumb_needs_jail(const struct tp_dispatch *tp, const struct tp_touch *t)
117 if (t->point.y < tp->thumb.upper_thumb_line ||
118 tp->scroll.method == LIBINPUT_CONFIG_SCROLL_EDGE)
121 if (!tp_thumb_in_exclusion_area(tp, t) &&
122 (tp->thumb.use_size || tp->thumb.use_pressure) &&
123 !tp_thumb_detect_pressure_size(tp, t))
133 tp_thumb_ignored(const struct tp_dispatch *tp, const struct tp_touch *t)
135 return (tp->thumb.detect_thumbs &&
136 tp->thumb.index == t->index &&
137 (tp->thumb.state == THUMB_STATE_JAILED ||
138 tp->thumb.state == THUMB_STATE_PINCH ||
139 tp->thumb.state == THUMB_STATE_SUPPRESSED ||
140 tp->thumb.state == THUMB_STATE_REVIVED_JAILED ||
141 tp->thumb.state == THUMB_STATE_DEAD));
145 tp_thumb_ignored_for_tap(const struct tp_dispatch *tp,
148 return (tp->thumb.detect_thumbs &&
149 tp->thumb.index == t->index &&
150 (tp->thumb.state == THUMB_STATE_PINCH ||
151 tp->thumb.state == THUMB_STATE_SUPPRESSED ||
152 tp->thumb.state == THUMB_STATE_DEAD));
156 tp_thumb_ignored_for_gesture(const struct tp_dispatch *tp,
159 return (tp->thumb.detect_thumbs &&
160 tp->thumb.index == t->index &&
161 (tp->thumb.state == THUMB_STATE_JAILED ||
162 tp->thumb.state == THUMB_STATE_SUPPRESSED ||
163 tp->thumb.state == THUMB_STATE_REVIVED_JAILED ||
164 tp->thumb.state == THUMB_STATE_DEAD));
168 tp_thumb_suppress(struct tp_dispatch *tp, struct tp_touch *t)
170 if(tp->thumb.state == THUMB_STATE_FINGER ||
171 tp->thumb.state == THUMB_STATE_JAILED ||
172 tp->thumb.state == THUMB_STATE_PINCH ||
173 tp->thumb.index != t->index) {
174 tp_thumb_set_state(tp, t, THUMB_STATE_SUPPRESSED);
178 tp_thumb_set_state(tp, t, THUMB_STATE_DEAD);
182 tp_thumb_pinch(struct tp_dispatch *tp, struct tp_touch *t)
184 if(tp->thumb.state == THUMB_STATE_FINGER ||
185 tp->thumb.state == THUMB_STATE_JAILED ||
186 tp->thumb.index != t->index)
187 tp_thumb_set_state(tp, t, THUMB_STATE_PINCH);
188 else if (tp->thumb.state != THUMB_STATE_PINCH)
189 tp_thumb_suppress(tp, t);
193 tp_thumb_revive(struct tp_dispatch *tp, struct tp_touch *t)
195 if((tp->thumb.state != THUMB_STATE_SUPPRESSED &&
196 tp->thumb.state != THUMB_STATE_PINCH) ||
197 (tp->thumb.index != t->index))
200 if(tp_thumb_needs_jail(tp, t))
201 tp_thumb_set_state(tp, t, THUMB_STATE_REVIVED_JAILED);
203 tp_thumb_set_state(tp, t, THUMB_STATE_REVIVED);
207 tp_thumb_update_touch(struct tp_dispatch *tp,
211 if (!tp->thumb.detect_thumbs)
218 tp->thumb.pinch_eligible &&
219 tp->gesture.state == GESTURE_STATE_NONE) {
220 tp->thumb.pinch_eligible = false;
221 if(tp->thumb.state == THUMB_STATE_PINCH) {
223 tp_for_each_touch(tp, thumb) {
224 if (thumb->index != tp->thumb.index)
227 tp_thumb_set_state(tp, thumb, THUMB_STATE_SUPPRESSED);
234 if (t->state == TOUCH_END && t->index == tp->thumb.index) {
235 tp_thumb_lift(tp);
242 if (tp->nfingers_down > 1)
248 tp_thumb_revive(tp, t);
253 if (t->state == TOUCH_BEGIN && tp_thumb_needs_jail(tp, t)) {
254 tp_thumb_set_state(tp, t, THUMB_STATE_JAILED);
261 if (tp->thumb.state == THUMB_STATE_JAILED &&
262 !(tp_thumb_needs_jail(tp, t)))
263 tp_thumb_set_state(tp, t, THUMB_STATE_FINGER);
264 if (tp->thumb.state == THUMB_STATE_REVIVED_JAILED &&
265 !(tp_thumb_needs_jail(tp, t)))
266 tp_thumb_set_state(tp, t, THUMB_STATE_REVIVED);
270 tp_thumb_update_multifinger(struct tp_dispatch *tp)
285 tp_for_each_touch(tp, t) {
321 mm = evdev_device_unit_delta_to_mm(tp->device, &distance);
329 tp->thumb.state == THUMB_STATE_FINGER &&
330 tp->nfingers_down >= 2 &&
332 (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG ||
334 evdev_log_debug(tp->device,
337 tp_thumb_suppress(tp, newest);
350 tp_thumb_lift(tp);
363 first->point.y < tp->thumb.lower_thumb_line) {
364 tp_thumb_lift(tp);
374 if (tp->thumb.pinch_eligible)
375 tp_thumb_pinch(tp, first);
377 tp_thumb_suppress(tp, first);
379 tp_thumb_lift(tp);
384 tp_init_thumb(struct tp_dispatch *tp)
386 struct evdev_device *device = tp->device;
394 tp->thumb.detect_thumbs = false;
396 if (!tp->buttons.is_clickpad)
406 tp->thumb.detect_thumbs = true;
407 tp->thumb.use_pressure = false;
408 tp->thumb.pressure_threshold = INT_MAX;
414 tp->thumb.upper_thumb_line = edges.y;
418 tp->thumb.lower_thumb_line = edges.y;
427 tp->thumb.use_pressure = true;
428 tp->thumb.pressure_threshold = threshold;
436 tp->thumb.use_size = true;
437 tp->thumb.size_threshold = threshold;
441 tp_thumb_reset(tp);
447 tp->thumb.use_pressure ? ", pressure" : "",
448 tp->thumb.use_size ? ", size" : "");
452 tp_thumb_get_touch(struct tp_dispatch *tp)
456 if (tp->thumb.index == UINT_MAX)
459 tp_for_each_touch(tp, thumb) {
460 if (thumb->index == tp->thumb.index)