Esempio n. 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;
}
Esempio n. 2
0
unsigned int
touchpad_tap_handle_timeout(struct touchpad *tp, unsigned int ms, void *userdata)
{
	if (!tp->tap.config.enabled)
		return 0;

	if (tp->tap.timeout && tp->tap.timeout <= ms) {
		touchpad_tap_clear_timer(tp, userdata);
		touchpad_tap_handle_event(tp, TAP_EVENT_TIMEOUT, userdata);
	}

	return tp->tap.timeout;
}
Esempio n. 3
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;
}