diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-08-07 20:47:56 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-08-07 20:47:56 +0200 |
| commit | 301cb7f95a4ca67b42410e65c71ddeefc379cb63 (patch) | |
| tree | 5f32a3180b15eba0a5620ac4b67d8cff6b090acf | |
| parent | f6e65676026fa9f3f2664100b68ba2c6da376a24 (diff) | |
Send proper begin/update/end status for gestures
For transient gestures like taps, use update only.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| -rw-r--r-- | src/gebuf.h | 1 | ||||
| -rw-r--r-- | src/gestures-tapping.c | 2 | ||||
| -rw-r--r-- | src/grail-gestures.c | 3 | ||||
| -rw-r--r-- | src/grail-inserter.c | 12 | ||||
| -rw-r--r-- | src/grail-inserter.h | 2 |
5 files changed, 12 insertions, 8 deletions
diff --git a/src/gebuf.h b/src/gebuf.h index 1b95cc6..460e134 100644 --- a/src/gebuf.h +++ b/src/gebuf.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #define DIM_GESTURE_EVENTS 512 | 28 | #define DIM_GESTURE_EVENTS 512 |
| 29 | 29 | ||
| 30 | struct gesture_event { | 30 | struct gesture_event { |
| 31 | int status; | ||
| 31 | int ntouch; | 32 | int ntouch; |
| 32 | int nprop; | 33 | int nprop; |
| 33 | touch_time_t time; | 34 | touch_time_t time; |
diff --git a/src/gestures-tapping.c b/src/gestures-tapping.c index 1a02731..0f9b215 100644 --- a/src/gestures-tapping.c +++ b/src/gestures-tapping.c | |||
| @@ -87,7 +87,7 @@ int gru_tapping(struct grail *ge, | |||
| 87 | prop[0] = move->time - state->start; | 87 | prop[0] = move->time - state->start; |
| 88 | gin_gid_event(ge, state->gid, | 88 | gin_gid_event(ge, state->gid, |
| 89 | move->fm[FM_X].val, move->fm[FM_Y].val, state->ntouch, | 89 | move->fm[FM_X].val, move->fm[FM_Y].val, state->ntouch, |
| 90 | prop, 1, GRAIL_STATUS_END); | 90 | prop, 1, 1); |
| 91 | state->status = TAP_BEGIN; | 91 | state->status = TAP_BEGIN; |
| 92 | state->ntouch = 0; | 92 | state->ntouch = 0; |
| 93 | state->active = 0; | 93 | state->active = 0; |
diff --git a/src/grail-gestures.c b/src/grail-gestures.c index 67ceacf..3daeaec 100644 --- a/src/grail-gestures.c +++ b/src/grail-gestures.c | |||
| @@ -189,8 +189,7 @@ void gru_event(struct grail *ge, int gid, | |||
| 189 | const grail_prop_t *prop, int nprop) | 189 | const grail_prop_t *prop, int nprop) |
| 190 | { | 190 | { |
| 191 | gin_gid_event(ge, gid, m->fm[FM_X].val, m->fm[FM_Y].val, m->ntouch, | 191 | gin_gid_event(ge, gid, m->fm[FM_X].val, m->fm[FM_Y].val, m->ntouch, |
| 192 | prop, nprop, | 192 | prop, nprop, 0); |
| 193 | GRAIL_STATUS_UPDATE); | ||
| 194 | } | 193 | } |
| 195 | 194 | ||
| 196 | void gru_end(struct grail *ge, int gid, const struct move_model *m) | 195 | void gru_end(struct grail *ge, int gid, const struct move_model *m) |
diff --git a/src/grail-inserter.c b/src/grail-inserter.c index 74a61b3..6ba9662 100644 --- a/src/grail-inserter.c +++ b/src/grail-inserter.c | |||
| @@ -54,7 +54,7 @@ static void send_event(struct grail *ge, struct slot_state *s, | |||
| 54 | return; | 54 | return; |
| 55 | gev.type = s->type; | 55 | gev.type = s->type; |
| 56 | gev.id = s->id; | 56 | gev.id = s->id; |
| 57 | gev.status = s->status; | 57 | gev.status = ev->status; |
| 58 | gev.ntouch = ev->ntouch; | 58 | gev.ntouch = ev->ntouch; |
| 59 | gev.nprop = ev->nprop; | 59 | gev.nprop = ev->nprop; |
| 60 | gev.time = ev->time; | 60 | gev.time = ev->time; |
| @@ -238,7 +238,7 @@ void gin_gid_discard(struct grail *ge, int gid) | |||
| 238 | void gin_gid_event(struct grail *ge, int gid, | 238 | void gin_gid_event(struct grail *ge, int gid, |
| 239 | float x, float y, int ntouch, | 239 | float x, float y, int ntouch, |
| 240 | const grail_prop_t *prop, int nprop, | 240 | const grail_prop_t *prop, int nprop, |
| 241 | int status) | 241 | int transient) |
| 242 | { | 242 | { |
| 243 | struct gesture_inserter *gin = ge->gin; | 243 | struct gesture_inserter *gin = ge->gin; |
| 244 | struct gesture_event ev; | 244 | struct gesture_event ev; |
| @@ -247,6 +247,7 @@ void gin_gid_event(struct grail *ge, int gid, | |||
| 247 | if (i < 0) | 247 | if (i < 0) |
| 248 | return; | 248 | return; |
| 249 | s = &gin->state[i]; | 249 | s = &gin->state[i]; |
| 250 | ev.status = transient ? GRAIL_STATUS_UPDATE : s->status; | ||
| 250 | ev.ntouch = ntouch; | 251 | ev.ntouch = ntouch; |
| 251 | ev.nprop = nprop; | 252 | ev.nprop = nprop; |
| 252 | ev.time = gin->time; | 253 | ev.time = gin->time; |
| @@ -254,8 +255,10 @@ void gin_gid_event(struct grail *ge, int gid, | |||
| 254 | ev.pos.y = y; | 255 | ev.pos.y = y; |
| 255 | memcpy(ev.prop, prop, nprop * sizeof(grail_prop_t)); | 256 | memcpy(ev.prop, prop, nprop * sizeof(grail_prop_t)); |
| 256 | gebuf_put(&s->buf, &ev); | 257 | gebuf_put(&s->buf, &ev); |
| 257 | if (s->status == GRAIL_STATUS_BEGIN) | 258 | if (transient) |
| 258 | s->status = status; | 259 | s->status = GRAIL_STATUS_END; |
| 260 | else if (s->status == GRAIL_STATUS_BEGIN) | ||
| 261 | s->status = GRAIL_STATUS_UPDATE; | ||
| 259 | } | 262 | } |
| 260 | 263 | ||
| 261 | void gin_gid_end(struct grail *ge, int gid, | 264 | void gin_gid_end(struct grail *ge, int gid, |
| @@ -269,6 +272,7 @@ void gin_gid_end(struct grail *ge, int gid, | |||
| 269 | return; | 272 | return; |
| 270 | s = &gin->state[i]; | 273 | s = &gin->state[i]; |
| 271 | if (s->status != GRAIL_STATUS_BEGIN) { | 274 | if (s->status != GRAIL_STATUS_BEGIN) { |
| 275 | ev.status = GRAIL_STATUS_END; | ||
| 272 | ev.ntouch = ntouch; | 276 | ev.ntouch = ntouch; |
| 273 | ev.nprop = 0; | 277 | ev.nprop = 0; |
| 274 | ev.time = gin->time; | 278 | ev.time = gin->time; |
diff --git a/src/grail-inserter.h b/src/grail-inserter.h index 08b6d21..04626af 100644 --- a/src/grail-inserter.h +++ b/src/grail-inserter.h | |||
| @@ -62,7 +62,7 @@ void gin_gid_discard(struct grail *ge, int gid); | |||
| 62 | void gin_gid_event(struct grail *ge, int gid, | 62 | void gin_gid_event(struct grail *ge, int gid, |
| 63 | float x, float y, int ntouch, | 63 | float x, float y, int ntouch, |
| 64 | const grail_prop_t *prop, int nprop, | 64 | const grail_prop_t *prop, int nprop, |
| 65 | int status); | 65 | int transient); |
| 66 | void gin_gid_end(struct grail *ge, int gid, | 66 | void gin_gid_end(struct grail *ge, int gid, |
| 67 | float x, float y, int ntouch); | 67 | float x, float y, int ntouch); |
| 68 | 68 | ||
