Exemple #1
0
int
touchpad_tap_handle_state(struct touchpad *tp)
{
	int i;
	for (i = 0; i < tp->ntouches; i++) {
		struct touch *t = touchpad_touch(tp, i);

		if (!t->dirty || t->state == TOUCH_NONE)
			continue;

		if (t->state == TOUCH_BEGIN)
			touchpad_tap_handle_event(tp, TAP_EVENT_TOUCH);
		else if (t->state == TOUCH_END)
			touchpad_tap_handle_event(tp, TAP_EVENT_RELEASE);
		else if (touchpad_tap_exceeds_motion_threshold(tp, t))
			touchpad_tap_handle_event(tp, TAP_EVENT_MOTION);
	}

	return 0;
}
Exemple #2
0
int
touchpad_tap_handle_state(struct touchpad *tp, void *userdata)
{
	struct touch *t;

	if (tp->queued & EVENT_BUTTON_PRESS)
		touchpad_tap_handle_event(tp, TAP_EVENT_BUTTON, userdata);

	touchpad_for_each_touch(tp, t) {
		if (!t->dirty || t->state == TOUCH_NONE)
			continue;

		if (t->state == TOUCH_BEGIN)
			touchpad_tap_handle_event(tp, TAP_EVENT_TOUCH, userdata);
		else if (t->state == TOUCH_END)
			touchpad_tap_handle_event(tp, TAP_EVENT_RELEASE, userdata);
		else if (tp->tap.state != TAP_STATE_IDLE &&
			 touchpad_tap_exceeds_motion_threshold(tp, t))
			touchpad_tap_handle_event(tp, TAP_EVENT_MOTION, userdata);
	}

	return 0;
}