From 301cb7f95a4ca67b42410e65c71ddeefc379cb63 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 7 Aug 2010 20:47:56 +0200 Subject: Send proper begin/update/end status for gestures For transient gestures like taps, use update only. Signed-off-by: Henrik Rydberg --- src/gebuf.h | 1 + src/gestures-tapping.c | 2 +- src/grail-gestures.c | 3 +-- src/grail-inserter.c | 12 ++++++++---- 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 @@ #define DIM_GESTURE_EVENTS 512 struct gesture_event { + int status; int ntouch; int nprop; 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, prop[0] = move->time - state->start; gin_gid_event(ge, state->gid, move->fm[FM_X].val, move->fm[FM_Y].val, state->ntouch, - prop, 1, GRAIL_STATUS_END); + prop, 1, 1); state->status = TAP_BEGIN; state->ntouch = 0; 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, const grail_prop_t *prop, int nprop) { gin_gid_event(ge, gid, m->fm[FM_X].val, m->fm[FM_Y].val, m->ntouch, - prop, nprop, - GRAIL_STATUS_UPDATE); + prop, nprop, 0); } 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, return; gev.type = s->type; gev.id = s->id; - gev.status = s->status; + gev.status = ev->status; gev.ntouch = ev->ntouch; gev.nprop = ev->nprop; gev.time = ev->time; @@ -238,7 +238,7 @@ void gin_gid_discard(struct grail *ge, int gid) void gin_gid_event(struct grail *ge, int gid, float x, float y, int ntouch, const grail_prop_t *prop, int nprop, - int status) + int transient) { struct gesture_inserter *gin = ge->gin; struct gesture_event ev; @@ -247,6 +247,7 @@ void gin_gid_event(struct grail *ge, int gid, if (i < 0) return; s = &gin->state[i]; + ev.status = transient ? GRAIL_STATUS_UPDATE : s->status; ev.ntouch = ntouch; ev.nprop = nprop; ev.time = gin->time; @@ -254,8 +255,10 @@ void gin_gid_event(struct grail *ge, int gid, ev.pos.y = y; memcpy(ev.prop, prop, nprop * sizeof(grail_prop_t)); gebuf_put(&s->buf, &ev); - if (s->status == GRAIL_STATUS_BEGIN) - s->status = status; + if (transient) + s->status = GRAIL_STATUS_END; + else if (s->status == GRAIL_STATUS_BEGIN) + s->status = GRAIL_STATUS_UPDATE; } void gin_gid_end(struct grail *ge, int gid, @@ -269,6 +272,7 @@ void gin_gid_end(struct grail *ge, int gid, return; s = &gin->state[i]; if (s->status != GRAIL_STATUS_BEGIN) { + ev.status = GRAIL_STATUS_END; ev.ntouch = ntouch; ev.nprop = 0; 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); void gin_gid_event(struct grail *ge, int gid, float x, float y, int ntouch, const grail_prop_t *prop, int nprop, - int status); + int transient); void gin_gid_end(struct grail *ge, int gid, float x, float y, int ntouch); -- cgit v1.2.3