コード例 #1
0
ファイル: touchpad-tap.c プロジェクト: whot/libtouchpad
static bool
touchpad_tap_exceeds_motion_threshold(struct touchpad *tp, struct touch *t)
{
	int threshold = tp->tap.config.move_threshold;
	int dx, dy;

	touchpad_motion_to_delta(t, &dx, &dy);

	return dx * dx + dy * dy > threshold * threshold;
}
コード例 #2
0
ファイル: touchpad-tap.c プロジェクト: RAOF/libtouchpad
static bool
touchpad_tap_exceeds_motion_threshold(struct touchpad *tp, struct touch *t)
{
	int threshold = TAP_MOTION_TRESHOLD;
	int dx, dy;
	int rc;

	touchpad_motion_to_delta(t, &dx, &dy);

	rc = (dx * dx + dy * dy > threshold * threshold);
	if (rc) {
		printf("motion exceeded for %d/%d\n", dx, dy);
		printf("%d/%d %d/%d\n", t->x, t->y, touchpad_history_get(t, -1)->x, touchpad_history_get(t, -1)->y);
	}
	return rc;
}
コード例 #3
0
ファイル: touchpad-events.c プロジェクト: RAOF/libtouchpad
static void
touchpad_post_motion_events(struct touchpad *tp, void *userdata)
{
	struct touch *t = touchpad_pointer_touch(tp);
	int dx, dy;

	if (t == NULL || !t->dirty)
		return;

	touchpad_motion_dejitter(t);
	touchpad_motion_to_delta(t, &dx, &dy);

	if (dx || dy)
		tp->interface->motion(tp, userdata, dx, dy);

	touchpad_history_push(t, t->x, t->y, t->millis);

	if (t->state == TOUCH_END)
		touchpad_history_reset(t);
}