summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-10 16:48:39 +0100
committerHenrik Rydberg <rydberg@euromail.se>2010-08-10 16:49:40 +0100
commit11ce60e63da0c632e4c06e212a3add7d53cbf658 (patch)
tree1588c1619df235727a62d3d9f9713d94a0c73170
parent33be41843e18b6a716ff62982e32c843e7a2bb1f (diff)
Make tapping position appear properly
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--include/grail-types.h2
-rw-r--r--src/gestures-tapping.c15
-rw-r--r--src/grail-gestures.h2
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 @@
65#define GRAIL_PROP_ROTATE_A 2 /* arc */ 65#define GRAIL_PROP_ROTATE_A 2 /* arc */
66 66
67#define GRAIL_PROP_TAP_DT 0 /* tap time (ms) */ 67#define GRAIL_PROP_TAP_DT 0 /* tap time (ms) */
68#define GRAIL_PROP_TAP_X 1 /* horizontal position */
69#define GRAIL_PROP_TAP_Y 2 /* vertical position */
68 70
69#endif 71#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,
37 struct gesture_recognizer *gru = ge->gru; 37 struct gesture_recognizer *gru = ge->gru;
38 struct tapping_model *state = &gru->tapping; 38 struct tapping_model *state = &gru->tapping;
39 struct move_model *move = &gru->move; 39 struct move_model *move = &gru->move;
40 grail_prop_t prop[DIM_GRAIL_PROP];
41 if (move->ntouch) { 40 if (move->ntouch) {
42 if (state->status == TAP_CANCEL) 41 if (state->status == TAP_CANCEL)
43 return 0; 42 return 0;
44 state->status = TAP_BEGIN; 43 state->status = TAP_BEGIN;
45 if (!state->ntouch) 44 if (!state->ntouch)
46 state->start = move->time; 45 state->start = move->time;
46 if (move->ntouch >= state->ntouch) {
47 state->prop[GRAIL_PROP_TAP_DT] =
48 move->time - state->start;
49 state->prop[GRAIL_PROP_TAP_X] = move->fm[FM_X].value;
50 state->prop[GRAIL_PROP_TAP_Y] = move->fm[FM_Y].value;
51 state->nprop = 3;
52 }
47 if (move->ntouch > state->ntouch) { 53 if (move->ntouch > state->ntouch) {
48 state->ntouch = move->ntouch; 54 state->ntouch = move->ntouch;
49 if (state->active) { 55 if (state->active) {
@@ -83,10 +89,11 @@ int gru_tapping(struct grail *ge,
83 if (state->status != TAP_END || 89 if (state->status != TAP_END ||
84 move->time - state->start < TAP_MIN_GAP_MS) 90 move->time - state->start < TAP_MIN_GAP_MS)
85 return 0; 91 return 0;
86 prop[GRAIL_PROP_TAP_DT] = move->time - state->start; 92 state->prop[GRAIL_PROP_TAP_DT] = move->time - state->start;
87 gin_gid_event(ge, state->gid, 93 gin_gid_event(ge, state->gid,
88 move->fm[FM_X].value, move->fm[FM_Y].value, state->ntouch, 94 state->prop[GRAIL_PROP_TAP_X],
89 prop, 1, 1); 95 state->prop[GRAIL_PROP_TAP_Y], state->ntouch,
96 state->prop, state->nprop, 1);
90 state->status = TAP_BEGIN; 97 state->status = TAP_BEGIN;
91 state->ntouch = 0; 98 state->ntouch = 0;
92 state->active = 0; 99 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 {
86 grail_time_t start; 86 grail_time_t start;
87 int status, ntouch; 87 int status, ntouch;
88 int active, gid; 88 int active, gid;
89 int nprop;
90 grail_prop_t prop[DIM_GRAIL_PROP];
89}; 91};
90 92
91int gru_tapping(struct grail *ge, 93int gru_tapping(struct grail *ge,