Lines Matching refs:tp

81 is_inside_bottom_button_area(const struct tp_dispatch *tp,
84 return t->point.y >= tp->buttons.bottom_area.top_edge;
88 is_inside_bottom_right_area(const struct tp_dispatch *tp,
91 return is_inside_bottom_button_area(tp, t) &&
92 t->point.x > tp->buttons.bottom_area.rightbutton_left_edge;
96 is_inside_bottom_middle_area(const struct tp_dispatch *tp,
99 return is_inside_bottom_button_area(tp, t) &&
100 !is_inside_bottom_right_area(tp, t) &&
101 t->point.x > tp->buttons.bottom_area.middlebutton_left_edge;
105 is_inside_top_button_area(const struct tp_dispatch *tp,
108 return t->point.y <= tp->buttons.top_area.bottom_edge;
112 is_inside_top_right_area(const struct tp_dispatch *tp,
115 return is_inside_top_button_area(tp, t) &&
116 t->point.x > tp->buttons.top_area.rightbutton_left_edge;
120 is_inside_top_middle_area(const struct tp_dispatch *tp,
123 return is_inside_top_button_area(tp, t) &&
124 t->point.x >= tp->buttons.top_area.leftbutton_right_edge &&
125 t->point.x <= tp->buttons.top_area.rightbutton_left_edge;
129 tp_button_set_enter_timer(struct tp_dispatch *tp,
138 tp_button_set_leave_timer(struct tp_dispatch *tp,
151 tp_button_set_state(struct tp_dispatch *tp,
175 tp_button_set_enter_timer(tp, t, time);
178 tp_button_set_leave_timer(tp, t, time);
187 tp_button_none_handle_event(struct tp_dispatch *tp,
196 tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM, event, time);
201 tp_button_set_state(tp, t, BUTTON_STATE_TOP_NEW, event, time);
204 tp_button_set_state(tp, t, BUTTON_STATE_AREA, event, time);
207 tp_button_set_state(tp, t, BUTTON_STATE_NONE, event, time);
217 tp_button_area_handle_event(struct tp_dispatch *tp,
232 tp_button_set_state(tp, t, BUTTON_STATE_NONE, event, time);
247 tp_button_release_other_bottom_touches(struct tp_dispatch *tp,
252 tp_for_each_touch(tp, t) {
272 tp_button_bottom_handle_event(struct tp_dispatch *tp,
282 tp_button_set_state(tp,
292 tp_button_set_state(tp, t, BUTTON_STATE_AREA, event, time);
299 tp_button_release_other_bottom_touches(tp,
303 tp_button_set_state(tp, t, BUTTON_STATE_NONE, event, time);
313 tp_button_top_handle_event(struct tp_dispatch *tp,
322 tp_button_set_state(tp, t, BUTTON_STATE_TOP_TO_IGNORE, event, time);
328 tp_button_set_state(tp,
335 tp_button_set_state(tp, t, BUTTON_STATE_TOP_TO_IGNORE, event, time);
338 tp_button_set_state(tp, t, BUTTON_STATE_NONE, event, time);
348 tp_button_top_new_handle_event(struct tp_dispatch *tp,
357 tp_button_set_state(tp, t, BUTTON_STATE_AREA, event, time);
363 tp_button_set_state(tp,
370 tp_button_set_state(tp, t, BUTTON_STATE_AREA, event, time);
373 tp_button_set_state(tp, t, BUTTON_STATE_NONE, event, time);
376 tp_button_set_state(tp, t, BUTTON_STATE_TOP, event, time);
381 tp_button_set_state(tp, t, BUTTON_STATE_TOP, event, time);
387 tp_button_top_to_ignore_handle_event(struct tp_dispatch *tp,
397 tp_button_set_state(tp,
403 tp_button_set_state(tp,
415 tp_button_set_state(tp, t, BUTTON_STATE_NONE, event, time);
421 tp_button_set_state(tp, t, BUTTON_STATE_IGNORE, event, time);
427 tp_button_ignore_handle_event(struct tp_dispatch *tp,
442 tp_button_set_state(tp, t, BUTTON_STATE_NONE, event, time);
455 tp_button_handle_event(struct tp_dispatch *tp,
464 tp_button_none_handle_event(tp, t, event, time);
467 tp_button_area_handle_event(tp, t, event, time);
470 tp_button_bottom_handle_event(tp, t, event, time);
473 tp_button_top_handle_event(tp, t, event, time);
476 tp_button_top_new_handle_event(tp, t, event, time);
479 tp_button_top_to_ignore_handle_event(tp, t, event, time);
482 tp_button_ignore_handle_event(tp, t, event, time);
487 evdev_log_debug(tp->device,
496 tp_button_check_for_movement(struct tp_dispatch *tp, struct tp_touch *t)
520 mm = evdev_device_unit_delta_to_mm(tp->device, &delta);
526 tp_button_release_other_bottom_touches(tp,
532 tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
536 tp_for_each_touch(tp, t) {
547 tp_button_handle_event(tp, t, BUTTON_EVENT_UP, time);
551 if (is_inside_bottom_button_area(tp, t)) {
552 if (is_inside_bottom_right_area(tp, t))
554 else if (is_inside_bottom_middle_area(tp, t))
561 tp_button_check_for_movement(tp, t);
562 } else if (is_inside_top_button_area(tp, t)) {
563 if (is_inside_top_right_area(tp, t))
565 else if (is_inside_top_middle_area(tp, t))
573 tp_button_handle_event(tp, t, event, time);
575 if (tp->queued & TOUCHPAD_EVENT_BUTTON_RELEASE)
576 tp_button_handle_event(tp, t, BUTTON_EVENT_RELEASE, time);
577 if (tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS)
578 tp_button_handle_event(tp, t, BUTTON_EVENT_PRESS, time);
587 tp_button_handle_event(t->tp, t, BUTTON_EVENT_TIMEOUT, now);
591 tp_process_button(struct tp_dispatch *tp,
598 if (tp->buttons.is_clickpad && e->code != BTN_LEFT) {
599 evdev_log_bug_kernel(tp->device,
606 tp->buttons.state |= mask;
607 tp->queued |= TOUCHPAD_EVENT_BUTTON_PRESS;
609 tp->buttons.state &= ~mask;
610 tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE;
615 tp_release_all_buttons(struct tp_dispatch *tp,
618 if (tp->buttons.state) {
619 tp->buttons.state = 0;
620 tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE;
625 tp_init_softbuttons(struct tp_dispatch *tp,
644 tp->buttons.bottom_area.top_edge = edges.y;
645 tp->buttons.bottom_area.rightbutton_left_edge = edges.x;
647 tp->buttons.bottom_area.middlebutton_left_edge = INT_MAX;
680 tp->buttons.bottom_area.middlebutton_left_edge = mb_le;
681 tp->buttons.bottom_area.rightbutton_left_edge = mb_re;
685 tp_init_top_softbuttons(struct tp_dispatch *tp,
691 if (tp->buttons.has_topbuttons) {
705 tp->buttons.top_area.bottom_edge = edges.y;
706 tp->buttons.top_area.rightbutton_left_edge = edges.x;
710 tp->buttons.top_area.leftbutton_right_edge = edges.x;
712 tp->buttons.top_area.bottom_edge = INT_MIN;
720 struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
723 if (tp->buttons.is_clickpad) {
725 if (tp->has_mt)
736 tp_switch_click_method(struct tp_dispatch *tp)
749 switch (tp->buttons.click_method) {
751 tp_init_softbuttons(tp, tp->device);
755 tp->buttons.bottom_area.top_edge = INT_MAX;
765 struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
767 tp->buttons.click_method = method;
768 tp_switch_click_method(tp);
777 struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
779 return tp->buttons.click_method;
783 tp_click_get_default_method(struct tp_dispatch *tp)
785 struct evdev_device *device = tp->device;
795 if (!tp->buttons.is_clickpad)
808 struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
810 return tp_click_get_default_method(tp);
816 struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch;
818 if (!tp->buttons.is_clickpad ||
819 tp->buttons.state != 0)
827 if (tp->buttons.click_method ==
829 tp_init_softbuttons(tp, device);
873 tp_init_clickpad_middlebutton_emulation(struct tp_dispatch *tp,
888 tp_init_middlebutton_emulation(struct tp_dispatch *tp,
896 if (tp->buttons.is_clickpad) {
897 tp_init_clickpad_middlebutton_emulation(tp, device);
916 evdev_init_middlebutton(tp->device,
922 tp_guess_clickpad(const struct tp_dispatch *tp, struct evdev_device *device)
939 (tp->device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON) == 0) {
962 tp_init_buttons(struct tp_dispatch *tp,
969 tp->buttons.is_clickpad = tp_guess_clickpad(tp, device);
971 tp->buttons.has_topbuttons = libevdev_has_property(device->evdev,
978 tp->buttons.motion_dist.x_scale_coeff = 1.0/absinfo_x->resolution;
979 tp->buttons.motion_dist.y_scale_coeff = 1.0/absinfo_y->resolution;
981 tp->buttons.config_method.get_methods = tp_button_config_click_get_methods;
982 tp->buttons.config_method.set_method = tp_button_config_click_set_method;
983 tp->buttons.config_method.get_method = tp_button_config_click_get_method;
984 tp->buttons.config_method.get_default_method = tp_button_config_click_get_default_method;
985 tp->device->base.config.click_method = &tp->buttons.config_method;
987 tp->buttons.click_method = tp_click_get_default_method(tp);
988 tp_switch_click_method(tp);
990 tp_init_top_softbuttons(tp, device, 1.0);
992 tp_init_middlebutton_emulation(tp, device);
995 tp_for_each_touch(tp, t) {
1006 tp_libinput_context(tp),
1013 tp_remove_buttons(struct tp_dispatch *tp)
1017 tp_for_each_touch(tp, t) {
1024 tp_post_physical_buttons(struct tp_dispatch *tp, uint64_t time)
1028 current = tp->buttons.state;
1029 old = tp->buttons.old_state;
1043 b = evdev_to_left_handed(tp->device, button);
1044 evdev_pointer_notify_physical_button(tp->device,
1059 tp_clickfinger_within_distance(struct tp_dispatch *tp,
1071 if (tp_thumb_ignored(tp, t1) || tp_thumb_ignored(tp, t2))
1077 xres = tp->device->abs.absinfo_x->resolution;
1078 yres = tp->device->abs.absinfo_y->resolution;
1101 if (tp->device->abs.dimensions.y/yres < 50)
1104 bottom_threshold = tp->device->abs.absinfo_y->maximum - 20 * yres;
1114 tp_clickfinger_set_button(struct tp_dispatch *tp)
1122 tp_for_each_touch(tp, t) {
1126 if (tp_thumb_ignored(tp, t))
1145 if (tp_clickfinger_within_distance(tp, first, second))
1165 tp_notify_clickpadbutton(struct tp_dispatch *tp,
1172 if (tp->buttons.trackpoint) {
1174 struct evdev_dispatch *dispatch = tp->buttons.trackpoint->dispatch;
1182 tp->buttons.trackpoint,
1186 tp->buttons.trackpoint,
1192 if (tp->device->is_suspended)
1198 tp_edge_scroll_stop_events(tp, time);
1204 if (tp->buttons.click_method == LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER &&
1206 button = tp_clickfinger_set_button(tp);
1207 tp->buttons.active = button;
1213 evdev_pointer_notify_button(tp->device, time, button, state);
1218 tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
1225 current = tp->buttons.state;
1226 old = tp->buttons.old_state;
1229 if (!tp->buttons.click_pending && current == old)
1236 if (evdev_device_has_model_quirk(tp->device,
1238 tp->nactive_slots == 0) {
1244 tp->buttons.click_pending = true;
1248 tp_for_each_touch(tp, t) {
1277 tp->buttons.click_method != LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER) {
1279 tp->buttons.click_pending = true;
1283 if ((tp->device->middlebutton.enabled || is_top) &&
1301 button = evdev_to_left_handed(tp->device, button);
1303 tp->buttons.active = button;
1304 tp->buttons.active_is_topbutton = is_top;
1307 button = tp->buttons.active;
1308 is_top = tp->buttons.active_is_topbutton;
1309 tp->buttons.active = 0;
1310 tp->buttons.active_is_topbutton = 0;
1314 tp->buttons.click_pending = false;
1317 return tp_notify_clickpadbutton(tp,
1326 tp_post_button_events(struct tp_dispatch *tp, uint64_t time)
1328 if (tp->buttons.is_clickpad ||
1329 tp->device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON)
1330 return tp_post_clickpadbutton_buttons(tp, time);
1331 return tp_post_physical_buttons(tp, time);
1335 tp_button_touch_active(const struct tp_dispatch *tp,
1342 tp_button_is_inside_softbutton_area(const struct tp_dispatch *tp,
1345 return is_inside_top_button_area(tp, t) ||
1346 is_inside_bottom_button_area(tp, t);