From 11ce60e63da0c632e4c06e212a3add7d53cbf658 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 10 Aug 2010 16:48:39 +0100 Subject: Make tapping position appear properly Signed-off-by: Henrik Rydberg --- include/grail-types.h | 2 ++ src/gestures-tapping.c | 15 +++++++++++---- src/grail-gestures.h | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/grail-types.h b/include/grail-types.h index 374f30a..66afd3f 100644 --- a/include/grail-types.h +++ b/include/grail-types.h @@ -65,5 +65,7 @@ #define GRAIL_PROP_ROTATE_A 2 /* arc */ #define GRAIL_PROP_TAP_DT 0 /* tap time (ms) */ +#define GRAIL_PROP_TAP_X 1 /* horizontal position */ +#define GRAIL_PROP_TAP_Y 2 /* vertical position */ #endif diff --git a/src/gestures-tapping.c b/src/gestures-tapping.c index 0deacf8..52c5fdb 100644 --- a/src/gestures-tapping.c +++ b/src/gestures-tapping.c @@ -37,13 +37,19 @@ int gru_tapping(struct grail *ge, struct gesture_recognizer *gru = ge->gru; struct tapping_model *state = &gru->tapping; struct move_model *move = &gru->move; - grail_prop_t prop[DIM_GRAIL_PROP]; if (move->ntouch) { if (state->status == TAP_CANCEL) return 0; state->status = TAP_BEGIN; if (!state->ntouch) state->start = move->time; + if (move->ntouch >= state->ntouch) { + state->prop[GRAIL_PROP_TAP_DT] = + move->time - state->start; + state->prop[GRAIL_PROP_TAP_X] = move->fm[FM_X].value; + state->prop[GRAIL_PROP_TAP_Y] = move->fm[FM_Y].value; + state->nprop = 3; + } if (move->ntouch > state->ntouch) { state->ntouch = move->ntouch; if (state->active) { @@ -83,10 +89,11 @@ int gru_tapping(struct grail *ge, if (state->status != TAP_END || move->time - state->start < TAP_MIN_GAP_MS) return 0; - prop[GRAIL_PROP_TAP_DT] = move->time - state->start; + state->prop[GRAIL_PROP_TAP_DT] = move->time - state->start; gin_gid_event(ge, state->gid, - move->fm[FM_X].value, move->fm[FM_Y].value, state->ntouch, - prop, 1, 1); + state->prop[GRAIL_PROP_TAP_X], + state->prop[GRAIL_PROP_TAP_Y], state->ntouch, + state->prop, state->nprop, 1); state->status = TAP_BEGIN; state->ntouch = 0; state->active = 0; diff --git a/src/grail-gestures.h b/src/grail-gestures.h index 5b8f7d7..888a50b 100644 --- a/src/grail-gestures.h +++ b/src/grail-gestures.h @@ -86,6 +86,8 @@ struct tapping_model { grail_time_t start; int status, ntouch; int active, gid; + int nprop; + grail_prop_t prop[DIM_GRAIL_PROP]; }; int gru_tapping(struct grail *ge, -- cgit v1.2.3