Lines Matching refs:tp

93 tp_get_touches_delta(struct tp_dispatch *tp, bool average)
99 for (i = 0; i < tp->num_slots; i++) {
100 t = &tp->touches[i];
102 if (!tp_touch_active_for_gesture(tp, t))
127 tp_gesture_init_scroll(struct tp_dispatch *tp)
130 tp->scroll.active.h = false;
131 tp->scroll.active.v = false;
132 tp->scroll.duration.h = 0;
133 tp->scroll.duration.v = 0;
134 tp->scroll.vector = zero;
135 tp->scroll.time_prev = 0;
139 tp_get_combined_touches_delta(struct tp_dispatch *tp)
141 return tp_get_touches_delta(tp, false);
145 tp_get_average_touches_delta(struct tp_dispatch *tp)
147 return tp_get_touches_delta(tp, true);
151 tp_gesture_start(struct tp_dispatch *tp, uint64_t time)
155 if (tp->gesture.started)
158 switch (tp->gesture.state) {
161 evdev_log_bug_libinput(tp->device,
167 gesture_notify_hold(&tp->device->base, time,
168 tp->gesture.finger_count);
171 tp_gesture_init_scroll(tp);
174 gesture_notify_pinch(&tp->device->base, time,
176 tp->gesture.finger_count,
180 gesture_notify_swipe(&tp->device->base, time,
182 tp->gesture.finger_count,
189 tp->gesture.started = true;
193 tp_get_raw_pointer_motion(struct tp_dispatch *tp)
198 if (tp->buttons.is_clickpad && tp->buttons.state)
199 raw = tp_get_combined_touches_delta(tp);
201 raw = tp_get_average_touches_delta(tp);
207 tp_has_pending_pointer_motion(struct tp_dispatch *tp, uint64_t time)
211 if (!(tp->queued & TOUCHPAD_EVENT_MOTION))
219 raw = tp_get_raw_pointer_motion(tp);
224 tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time)
229 raw = tp_get_raw_pointer_motion(tp);
230 delta = tp_filter_motion(tp, &raw, time);
235 unaccel = tp_scale_to_xaxis(tp, raw);
236 pointer_notify_motion(&tp->device->base,
244 tp_gesture_get_active_touches(const struct tp_dispatch *tp,
253 tp_for_each_touch(tp, t) {
254 if (tp_touch_active_for_gesture(tp, t)) {
291 tp_gesture_mm_moved(struct tp_dispatch *tp, struct tp_touch *t)
298 return evdev_device_unit_delta_to_mm(tp->device, &delta);
302 tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch)
308 mm = tp_phys_delta(tp, delta);
314 tp_gesture_get_pinch_info(struct tp_dispatch *tp,
321 struct tp_touch *first = tp->gesture.touches[0],
322 *second = tp->gesture.touches[1];
325 normalized = tp_normalize_delta(tp, delta);
333 tp_gesture_init_pinch(struct tp_dispatch *tp)
335 tp_gesture_get_pinch_info(tp,
336 &tp->gesture.initial_distance,
337 &tp->gesture.angle,
338 &tp->gesture.center);
339 tp->gesture.prev_scale = 1.0;
343 tp_gesture_set_scroll_buildup(struct tp_dispatch *tp)
347 struct tp_touch *first = tp->gesture.touches[0],
348 *second = tp->gesture.touches[1];
354 tp->device->scroll.buildup = tp_normalize_delta(tp, average);
358 tp_gesture_apply_scroll_constraints(struct tp_dispatch *tp,
372 if (tp->scroll.active.h && tp->scroll.active.v)
376 if (tp->scroll.time_prev != 0)
377 tdelta = time - tp->scroll.time_prev;
380 tp->scroll.time_prev = time;
383 delta_mm = tp_phys_delta(tp, *raw);
403 vector.x = (tp->scroll.vector.x * vector_decay) + delta_mm.x;
404 vector.y = (tp->scroll.vector.y * vector_decay) + delta_mm.y;
406 tp->scroll.vector = vector;
428 tp->scroll.duration.v += tdelta;
429 if (tp->scroll.duration.v > ACTIVE_THRESHOLD)
430 tp->scroll.duration.v = ACTIVE_THRESHOLD;
432 if (tp->scroll.duration.h > tdelta)
433 tp->scroll.duration.h -= tdelta;
435 tp->scroll.duration.h = 0;
439 tp->scroll.duration.h += tdelta;
440 if (tp->scroll.duration.h > ACTIVE_THRESHOLD)
441 tp->scroll.duration.h = ACTIVE_THRESHOLD;
443 if (tp->scroll.duration.v > tdelta)
444 tp->scroll.duration.v -= tdelta;
446 tp->scroll.duration.v = 0;
450 if (tp->scroll.duration.h == ACTIVE_THRESHOLD) {
451 tp->scroll.active.h = true;
452 if (tp->scroll.duration.v < INACTIVE_THRESHOLD)
453 tp->scroll.active.v = false;
455 if (tp->scroll.duration.v == ACTIVE_THRESHOLD) {
456 tp->scroll.active.v = true;
457 if (tp->scroll.duration.h < INACTIVE_THRESHOLD)
458 tp->scroll.active.h = false;
465 tp->scroll.active.v = true;
466 tp->scroll.active.h = true;
473 if (!tp->scroll.active.h && tp->scroll.active.v)
475 if (tp->scroll.active.h && !tp->scroll.active.v)
479 if (!tp->scroll.active.h && !tp->scroll.active.v) {
486 log_gesture_bug(struct tp_dispatch *tp, enum gesture_event event)
488 evdev_log_bug_libinput(tp->device,
491 gesture_state_to_str(tp->gesture.state));
495 tp_gesture_is_quick_hold(struct tp_dispatch *tp)
501 return (tp->gesture.finger_count == 1) ||
502 (tp->gesture.finger_count == 2);
506 tp_gesture_use_hold_timer(struct tp_dispatch *tp)
509 if (!tp->tap.enabled)
513 if (tp_gesture_is_quick_hold(tp))
519 if (tp->gesture.finger_count > 3)
525 if (tp->tap.state == TAP_STATE_HOLD ||
526 tp->tap.state == TAP_STATE_TOUCH_2_HOLD ||
527 tp->tap.state == TAP_STATE_TOUCH_3_HOLD)
533 if (tp->tap.state == TAP_STATE_DEAD)
541 tp_gesture_set_hold_timer(struct tp_dispatch *tp, uint64_t time)
545 if (!tp->gesture.hold_enabled)
548 if (tp_gesture_use_hold_timer(tp)) {
549 timeout = tp_gesture_is_quick_hold(tp) ?
553 libinput_timer_set(&tp->gesture.hold_timer, time + timeout);
558 tp_gesture_handle_event_on_state_none(struct tp_dispatch *tp,
564 libinput_timer_cancel(&tp->gesture.hold_timer);
567 tp_gesture_set_hold_timer(tp, time);
568 tp->gesture.state = GESTURE_STATE_UNKNOWN;
573 tp->gesture.state = GESTURE_STATE_POINTER_MOTION;
576 tp->gesture.state = GESTURE_STATE_SCROLL;
581 log_gesture_bug(tp, event);
587 tp_gesture_handle_event_on_state_unknown(struct tp_dispatch *tp,
593 libinput_timer_cancel(&tp->gesture.hold_timer);
594 tp->gesture.state = GESTURE_STATE_NONE;
597 tp->gesture.state = GESTURE_STATE_HOLD;
598 tp_gesture_start(tp, time);
603 tp->gesture.state = GESTURE_STATE_POINTER_MOTION;
606 libinput_timer_cancel(&tp->gesture.hold_timer);
607 tp_gesture_set_scroll_buildup(tp);
608 tp->gesture.state = GESTURE_STATE_SCROLL;
611 libinput_timer_cancel(&tp->gesture.hold_timer);
612 tp->gesture.state = GESTURE_STATE_SWIPE;
615 libinput_timer_cancel(&tp->gesture.hold_timer);
616 tp_gesture_init_pinch(tp);
617 tp->gesture.state = GESTURE_STATE_PINCH;
621 log_gesture_bug(tp, event);
627 tp_gesture_handle_event_on_state_hold(struct tp_dispatch *tp,
633 libinput_timer_cancel(&tp->gesture.hold_timer);
634 tp->gesture.state = GESTURE_STATE_NONE;
637 tp->gesture.state = GESTURE_STATE_HOLD_AND_MOTION;
640 tp_gesture_cancel(tp, time);
641 tp->gesture.state = GESTURE_STATE_POINTER_MOTION;
644 tp_gesture_set_scroll_buildup(tp);
645 tp_gesture_cancel(tp, time);
646 tp->gesture.state = GESTURE_STATE_SCROLL;
649 tp_gesture_cancel(tp, time);
650 tp->gesture.state = GESTURE_STATE_SWIPE;
653 tp_gesture_init_pinch(tp);
654 tp_gesture_cancel(tp, time);
655 tp->gesture.state = GESTURE_STATE_PINCH;
659 log_gesture_bug(tp, event);
665 tp_gesture_handle_event_on_state_hold_and_motion(struct tp_dispatch *tp,
671 libinput_timer_cancel(&tp->gesture.hold_timer);
672 tp->gesture.state = GESTURE_STATE_NONE;
675 tp_gesture_cancel(tp, time);
676 tp->gesture.state = GESTURE_STATE_POINTER_MOTION;
684 log_gesture_bug(tp, event);
690 tp_gesture_handle_event_on_state_pointer_motion(struct tp_dispatch *tp,
700 libinput_timer_cancel(&tp->gesture.hold_timer);
701 tp->gesture.state = GESTURE_STATE_NONE;
704 if (tp->gesture.finger_count != 1)
707 first = tp->gesture.touches[0];
708 first_moved = tp_gesture_mm_moved(tp, first);
712 tp->gesture.state = GESTURE_STATE_HOLD_AND_MOTION;
713 tp_gesture_start(tp, time);
722 log_gesture_bug(tp, event);
728 tp_gesture_handle_event_on_state_scroll(struct tp_dispatch *tp,
734 libinput_timer_cancel(&tp->gesture.hold_timer);
735 tp->gesture.state = GESTURE_STATE_NONE;
738 tp_gesture_init_pinch(tp);
739 tp_gesture_cancel(tp, time);
740 tp->gesture.state = GESTURE_STATE_PINCH;
748 log_gesture_bug(tp, event);
754 tp_gesture_handle_event_on_state_pinch(struct tp_dispatch *tp,
760 libinput_timer_cancel(&tp->gesture.hold_timer);
761 tp->gesture.state = GESTURE_STATE_NONE;
770 log_gesture_bug(tp, event);
776 tp_gesture_handle_event_on_state_swipe(struct tp_dispatch *tp,
782 libinput_timer_cancel(&tp->gesture.hold_timer);
783 tp->gesture.state = GESTURE_STATE_NONE;
792 log_gesture_bug(tp, event);
798 tp_gesture_handle_event(struct tp_dispatch *tp,
804 oldstate = tp->gesture.state;
806 switch(tp->gesture.state) {
808 tp_gesture_handle_event_on_state_none(tp, event, time);
811 tp_gesture_handle_event_on_state_unknown(tp, event, time);
814 tp_gesture_handle_event_on_state_hold(tp, event, time);
817 tp_gesture_handle_event_on_state_hold_and_motion(tp, event, time);
820 tp_gesture_handle_event_on_state_pointer_motion(tp, event, time);
823 tp_gesture_handle_event_on_state_scroll(tp, event, time);
826 tp_gesture_handle_event_on_state_pinch(tp, event, time);
829 tp_gesture_handle_event_on_state_swipe(tp, event, time);
833 if (oldstate != tp->gesture.state) {
834 evdev_log_debug(tp->device,
838 gesture_state_to_str(tp->gesture.state));
845 struct tp_dispatch *tp = data;
847 if (tp_tap_dragging_or_double_tapping(tp) || tp_tap_dragging(tp))
850 tp_gesture_handle_event(tp, GESTURE_EVENT_HOLD_TIMEOUT, now);
854 tp_gesture_tap_timeout(struct tp_dispatch *tp, uint64_t time)
856 if (!tp->gesture.hold_enabled)
859 if (!tp_gesture_is_quick_hold(tp))
860 tp_gesture_handle_event(tp, GESTURE_EVENT_HOLD_TIMEOUT, time);
864 tp_gesture_detect_motion_gestures(struct tp_dispatch *tp, uint64_t time)
866 struct tp_touch *first = tp->gesture.touches[0],
867 *second = tp->gesture.touches[1],
878 first_moved = tp_gesture_mm_moved(tp, first);
881 if (tp->gesture.finger_count == 1) {
882 if (!tp_has_pending_pointer_motion(tp, time))
887 if (tp->gesture.state == GESTURE_STATE_HOLD &&
889 tp_gesture_handle_event(tp,
895 if (tp->gesture.state == GESTURE_STATE_HOLD_AND_MOTION &&
899 tp_gesture_handle_event(tp,
907 if (tp->gesture.enabled && tp->gesture.finger_count > 2 &&
908 tp->gesture.finger_count > tp->num_slots) {
909 tp_gesture_handle_event(tp, GESTURE_EVENT_SWIPE, time);
914 max_move += 2.0 * (tp->gesture.finger_count - 2);
915 min_move += 0.5 * (tp->gesture.finger_count - 2);
917 second_moved = tp_gesture_mm_moved(tp, second);
922 distance_mm = evdev_device_unit_delta_to_mm(tp->device, &delta);
941 if ((!tp->gesture.enabled ||
943 time > (tp->gesture.initial_time + DEFAULT_GESTURE_SWIPE_TIMEOUT)) {
944 if (tp->gesture.finger_count == 2)
945 tp_gesture_handle_event(tp, GESTURE_EVENT_SCROLL, time);
947 tp_gesture_handle_event(tp, GESTURE_EVENT_SWIPE, time);
963 if (tp->thumb.detect_thumbs && thumb_mm < min_move) {
964 tp_thumb_suppress(tp, thumb);
965 tp_gesture_cancel(tp, time);
973 if ((!tp->gesture.enabled || finger_mm < min_move) &&
974 tp->gesture.finger_count == 2) {
975 tp_gesture_handle_event(tp, GESTURE_EVENT_SCROLL, time);
983 tp->gesture.finger_count > 2 &&
984 tp->gesture.enabled &&
985 tp->thumb.pinch_eligible) {
986 tp_gesture_handle_event(tp, GESTURE_EVENT_PINCH, time);
1001 dir1 = tp_gesture_get_direction(tp, first);
1002 dir2 = tp_gesture_get_direction(tp, second);
1007 if (tp->gesture.finger_count > tp->num_slots ||
1009 if (tp->gesture.finger_count == 2) {
1010 tp_gesture_handle_event(tp, GESTURE_EVENT_SCROLL, time);
1014 if (tp->gesture.enabled) {
1015 tp_gesture_handle_event(tp, GESTURE_EVENT_SWIPE, time);
1021 tp_gesture_handle_event(tp, GESTURE_EVENT_PINCH, time);
1025 tp_gesture_is_pinch(struct tp_dispatch *tp)
1027 struct tp_touch *first = tp->gesture.touches[0],
1028 *second = tp->gesture.touches[1];
1033 dir1 = tp_gesture_get_direction(tp, first);
1034 dir2 = tp_gesture_get_direction(tp, second);
1038 first_moved = tp_gesture_mm_moved(tp, first);
1043 second_moved = tp_gesture_mm_moved(tp, second);
1052 tp_gesture_handle_state_none(struct tp_dispatch *tp, uint64_t time)
1059 ntouches = tp_gesture_get_active_touches(tp, touches, 4);
1069 tp->gesture.touches[0] = first;
1071 tp_gesture_handle_event(tp,
1077 if (!tp->gesture.enabled) {
1079 tp_gesture_handle_event(tp, GESTURE_EVENT_SCROLL, time);
1104 for (i = 1; i < ntouches && i < tp->num_slots; i++) {
1116 tp->gesture.initial_time = time;
1119 tp->gesture.touches[0] = first;
1120 tp->gesture.touches[1] = second;
1122 tp_gesture_handle_event(tp, GESTURE_EVENT_FINGER_DETECTED, time);
1126 tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time,
1130 tp_gesture_detect_motion_gestures(tp, time);
1134 tp_gesture_handle_state_hold(struct tp_dispatch *tp, uint64_t time,
1137 tp_gesture_start(tp, time);
1140 tp_gesture_detect_motion_gestures(tp, time);
1144 tp_gesture_handle_state_hold_and_pointer_motion(struct tp_dispatch *tp, uint64_t time)
1146 if (tp->queued & TOUCHPAD_EVENT_MOTION)
1147 tp_gesture_post_pointer_motion(tp, time);
1149 tp_gesture_detect_motion_gestures(tp, time);
1153 tp_gesture_handle_state_pointer_motion(struct tp_dispatch *tp, uint64_t time)
1155 if (tp->queued & TOUCHPAD_EVENT_MOTION)
1156 tp_gesture_post_pointer_motion(tp, time);
1160 tp_gesture_handle_state_scroll(struct tp_dispatch *tp, uint64_t time)
1165 if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
1171 if (time < (tp->gesture.initial_time + DEFAULT_GESTURE_PINCH_TIMEOUT) &&
1172 tp_gesture_is_pinch(tp)) {
1173 tp_gesture_handle_event(tp, GESTURE_EVENT_PINCH, time);
1177 raw = tp_get_average_touches_delta(tp);
1180 delta = tp_filter_scroll(tp, &raw, time);
1185 tp_gesture_start(tp, time);
1186 tp_gesture_apply_scroll_constraints(tp, &raw, &delta, time);
1187 evdev_post_scroll(tp->device,
1194 tp_gesture_handle_state_swipe(struct tp_dispatch *tp, uint64_t time)
1199 raw = tp_get_average_touches_delta(tp);
1200 delta = tp_filter_motion(tp, &raw, time);
1203 unaccel = tp_filter_motion_unaccelerated(tp, &raw, time);
1204 tp_gesture_start(tp, time);
1205 gesture_notify_swipe(&tp->device->base, time,
1207 tp->gesture.finger_count,
1213 tp_gesture_handle_state_pinch(struct tp_dispatch *tp, uint64_t time)
1219 tp_gesture_get_pinch_info(tp, &distance, &angle, &center);
1221 scale = distance / tp->gesture.initial_distance;
1223 angle_delta = angle - tp->gesture.angle;
1224 tp->gesture.angle = angle;
1230 fdelta = device_float_delta(center, tp->gesture.center);
1231 tp->gesture.center = center;
1233 delta = tp_filter_motion(tp, &fdelta, time);
1236 scale == tp->gesture.prev_scale && angle_delta == 0.0)
1239 unaccel = tp_filter_motion_unaccelerated(tp, &fdelta, time);
1240 tp_gesture_start(tp, time);
1241 gesture_notify_pinch(&tp->device->base, time,
1243 tp->gesture.finger_count,
1246 tp->gesture.prev_scale = scale;
1250 tp_gesture_post_gesture(struct tp_dispatch *tp, uint64_t time,
1253 if (tp->gesture.state == GESTURE_STATE_NONE)
1254 tp_gesture_handle_state_none(tp, time);
1256 if (tp->gesture.state == GESTURE_STATE_UNKNOWN)
1257 tp_gesture_handle_state_unknown(tp, time, ignore_motion);
1259 if (tp->gesture.state == GESTURE_STATE_HOLD)
1260 tp_gesture_handle_state_hold(tp, time, ignore_motion);
1262 if (tp->gesture.state == GESTURE_STATE_POINTER_MOTION)
1263 tp_gesture_handle_state_pointer_motion(tp, time);
1265 if (tp->gesture.state == GESTURE_STATE_HOLD_AND_MOTION)
1266 tp_gesture_handle_state_hold_and_pointer_motion(tp, time);
1268 if (tp->gesture.state == GESTURE_STATE_SCROLL)
1269 tp_gesture_handle_state_scroll(tp, time);
1271 if (tp->gesture.state == GESTURE_STATE_SWIPE)
1272 tp_gesture_handle_state_swipe(tp, time);
1274 if (tp->gesture.state == GESTURE_STATE_PINCH)
1275 tp_gesture_handle_state_pinch(tp, time);
1279 tp_gesture_thumb_moved(struct tp_dispatch *tp)
1285 thumb = tp_thumb_get_touch(tp);
1289 if (!tp_touch_active_for_gesture(tp, thumb))
1292 thumb_moved = tp_gesture_mm_moved(tp, thumb);
1298 tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time,
1301 if (tp->gesture.finger_count == 0)
1308 if (tp_tap_dragging(tp) ||
1309 (tp->buttons.is_clickpad && tp->buttons.state &&
1310 tp->thumb.state == THUMB_STATE_FINGER)) {
1311 if (tp->gesture.state != GESTURE_STATE_POINTER_MOTION) {
1312 tp_gesture_cancel(tp, time);
1313 tp_gesture_handle_event(tp,
1317 tp->gesture.finger_count = 1;
1318 tp->gesture.finger_count_pending = 0;
1322 if (tp->gesture.finger_count_pending)
1328 if (time < (tp->gesture.initial_time + DEFAULT_GESTURE_PINCH_TIMEOUT) &&
1329 tp_gesture_thumb_moved(tp))
1330 tp_thumb_reset(tp);
1332 if (tp->gesture.finger_count <= 4)
1333 tp_gesture_post_gesture(tp, time, ignore_motion);
1337 tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
1339 if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
1342 evdev_stop_scroll(tp->device,
1348 tp_gesture_end(struct tp_dispatch *tp, uint64_t time, bool cancelled)
1350 enum tp_gesture_state state = tp->gesture.state;
1352 if (!tp->gesture.started) {
1353 tp_gesture_handle_event(tp, GESTURE_EVENT_RESET, time);
1360 evdev_log_bug_libinput(tp->device,
1366 gesture_notify_hold_end(&tp->device->base, time,
1367 tp->gesture.finger_count, cancelled);
1370 tp_gesture_stop_twofinger_scroll(tp, time);
1373 gesture_notify_pinch_end(&tp->device->base, time,
1374 tp->gesture.finger_count,
1375 tp->gesture.prev_scale,
1379 gesture_notify_swipe_end(&tp->device->base,
1381 tp->gesture.finger_count,
1388 tp->gesture.started = false;
1389 tp_gesture_handle_event(tp, GESTURE_EVENT_RESET, time);
1393 tp_gesture_cancel(struct tp_dispatch *tp, uint64_t time)
1395 tp_gesture_end(tp, time, true);
1399 tp_gesture_cancel_motion_gestures(struct tp_dispatch *tp, uint64_t time)
1401 if (tp->gesture.started && tp->gesture.state != GESTURE_STATE_HOLD)
1402 tp_gesture_end(tp, time, true);
1406 tp_gesture_stop(struct tp_dispatch *tp, uint64_t time)
1408 tp_gesture_end(tp, time, false);
1414 struct tp_dispatch *tp = data;
1416 if (!tp->gesture.finger_count_pending)
1419 tp_gesture_cancel(tp, now); /* End current gesture */
1420 tp->gesture.finger_count = tp->gesture.finger_count_pending;
1421 tp->gesture.finger_count_pending = 0;
1425 tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time)
1430 tp_for_each_touch(tp, t) {
1431 if (tp_touch_active_for_gesture(tp, t))
1435 if (active_touches != tp->gesture.finger_count) {
1438 tp_gesture_stop(tp, time);
1439 tp->gesture.finger_count = 0;
1440 tp->gesture.finger_count_pending = 0;
1442 } else if (!tp->gesture.started) {
1443 tp->gesture.finger_count = active_touches;
1444 tp->gesture.finger_count_pending = 0;
1448 if (tp->gesture.state == GESTURE_STATE_UNKNOWN ||
1449 tp->gesture.state == GESTURE_STATE_POINTER_MOTION) {
1450 tp_gesture_handle_event(tp,
1455 } else if (active_touches != tp->gesture.finger_count_pending) {
1456 tp->gesture.finger_count_pending = active_touches;
1457 libinput_timer_set(&tp->gesture.finger_count_switch_timer,
1461 tp->gesture.finger_count_pending = 0;
1466 tp_gesture_are_gestures_enabled(struct tp_dispatch *tp)
1468 return (!tp->semi_mt && tp->num_slots > 1);
1476 struct tp_dispatch *tp = tp_dispatch(dispatch);
1478 if (!tp_gesture_are_gestures_enabled(tp))
1481 tp->gesture.hold_enabled = (enabled == LIBINPUT_CONFIG_HOLD_ENABLED);
1490 struct tp_dispatch *tp = tp_dispatch(dispatch);
1492 return tp->gesture.hold_enabled ? LIBINPUT_CONFIG_HOLD_ENABLED :
1500 struct tp_dispatch *tp = tp_dispatch(dispatch);
1502 return tp_gesture_are_gestures_enabled(tp) ?
1508 tp_init_gesture(struct tp_dispatch *tp)
1512 tp->gesture.config.set_hold_enabled = tp_gesture_set_hold_enabled;
1513 tp->gesture.config.get_hold_enabled = tp_gesture_is_hold_enabled;
1514 tp->gesture.config.get_hold_default = tp_gesture_get_hold_default;
1515 tp->device->base.config.gesture = &tp->gesture.config;
1520 tp->gesture.enabled = tp_gesture_are_gestures_enabled(tp);
1522 tp->gesture.state = GESTURE_STATE_NONE;
1523 tp->gesture.hold_enabled = tp_gesture_are_gestures_enabled(tp);
1528 evdev_device_get_sysname(tp->device));
1529 libinput_timer_init(&tp->gesture.finger_count_switch_timer,
1530 tp_libinput_context(tp),
1532 tp_gesture_finger_count_switch_timeout, tp);
1537 evdev_device_get_sysname(tp->device));
1538 libinput_timer_init(&tp->gesture.hold_timer,
1539 tp_libinput_context(tp),
1541 tp_gesture_hold_timeout, tp);
1545 tp_remove_gesture(struct tp_dispatch *tp)
1547 libinput_timer_cancel(&tp->gesture.finger_count_switch_timer);
1548 libinput_timer_cancel(&tp->gesture.hold_timer);