From 76f51a7675801acfe8e58c6a21192668d23d3320 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Thu, 19 Aug 2010 22:15:55 +0200 Subject: Add contact information to the property list Add the five first contacts to the property list, and unify the handling of all gesture types in this regard. To avoid duplication, move the scaling of properties closer to the gesture recognizer. Move all gesture event handling code to grail-event.c, simplifying the structure somewhat. Signed-off-by: Henrik Rydberg --- src/gestures-pinch.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/gestures-pinch.c') diff --git a/src/gestures-pinch.c b/src/gestures-pinch.c index d05b06f..45f1cb3 100644 --- a/src/gestures-pinch.c +++ b/src/gestures-pinch.c @@ -35,23 +35,16 @@ static const int getype[DIM_TOUCH + 1] = { static const int fm_mask = 0x04; -static void set_props(struct combo_model *s, +static void set_props(const struct gesture_inserter *gin, + struct combo_model *s, const struct move_model *m, const struct touch_frame *frame) { - struct grail_coord min, max; - s->prop[GRAIL_PROP_PINCH_DR] = m->fm[FM_R].action_delta; - s->prop[GRAIL_PROP_PINCH_VR] = m->fm[FM_R].velocity; - s->prop[GRAIL_PROP_PINCH_R] = m->fm[FM_R].value; + s->prop[GRAIL_PROP_PINCH_DR] = gin->scale_r * m->fm[FM_R].action_delta; + s->prop[GRAIL_PROP_PINCH_VR] = gin->scale_r * m->fm[FM_R].velocity; + s->prop[GRAIL_PROP_PINCH_R] = gin->scale_r * m->fm[FM_R].value; s->nprop = 3; - if (!frame->nactive) - return; - gru_compute_bbox(&min, &max, frame); - s->prop[GRAIL_PROP_PINCH_X1] = min.x; - s->prop[GRAIL_PROP_PINCH_Y1] = min.y; - s->prop[GRAIL_PROP_PINCH_X2] = max.x; - s->prop[GRAIL_PROP_PINCH_Y2] = max.y; - s->nprop = 7; + s->nprop += gin_add_contact_props(gin, s->prop + s->nprop, frame); } int gru_pinch(struct grail *ge, @@ -80,7 +73,7 @@ int gru_pinch(struct grail *ge, } if (!(move->active & fm_mask)) return 0; - set_props(state, move, frame); + set_props(ge->gin, state, move, frame); gru_event(ge, state->gid, move, state->prop, state->nprop); return 1; } @@ -121,7 +114,7 @@ int gru_winpinch(struct grail *ge, } if (!(move->active & fm_mask)) return 0; - set_props(state, move, frame); + set_props(ge->gin, state, move, frame); gru_event(ge, state->gid, move, state->prop, state->nprop); return 1; } -- cgit v1.2.3