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-drag.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/gestures-drag.c') diff --git a/src/gestures-drag.c b/src/gestures-drag.c index 253bc9d..8b57b99 100644 --- a/src/gestures-drag.c +++ b/src/gestures-drag.c @@ -33,20 +33,27 @@ static const int getype[DIM_TOUCH + 1] = { GRAIL_TYPE_DRAG5, }; -static void set_props(struct combo_model *s, const struct move_model *m) +static void set_props(const struct gesture_inserter *gin, + struct combo_model *s, const struct move_model *m, + const struct touch_frame *frame) { if (m->single) { - s->prop[GRAIL_PROP_DRAG_DX] = m->fm[FM_X].raw_delta; - s->prop[GRAIL_PROP_DRAG_DY] = m->fm[FM_Y].raw_delta; + s->prop[GRAIL_PROP_DRAG_DX] = + gin->scale_x * m->fm[FM_X].raw_delta; + s->prop[GRAIL_PROP_DRAG_DY] = + gin->scale_y * m->fm[FM_Y].raw_delta; } else { - s->prop[GRAIL_PROP_DRAG_DX] = m->fm[FM_X].action_delta; - s->prop[GRAIL_PROP_DRAG_DY] = m->fm[FM_Y].action_delta; + s->prop[GRAIL_PROP_DRAG_DX] = + gin->scale_x * m->fm[FM_X].action_delta; + s->prop[GRAIL_PROP_DRAG_DY] = + gin->scale_y * m->fm[FM_Y].action_delta; } - s->prop[GRAIL_PROP_DRAG_VX] = m->fm[FM_X].velocity; - s->prop[GRAIL_PROP_DRAG_VY] = m->fm[FM_Y].velocity; - s->prop[GRAIL_PROP_DRAG_X] = m->fm[FM_X].value; - s->prop[GRAIL_PROP_DRAG_Y] = m->fm[FM_Y].value; + s->prop[GRAIL_PROP_DRAG_VX] = gin->scale_x * m->fm[FM_X].velocity; + s->prop[GRAIL_PROP_DRAG_VY] = gin->scale_y * m->fm[FM_Y].velocity; + s->prop[GRAIL_PROP_DRAG_X] = gin_prop_x(gin, m->fm[FM_X].value); + s->prop[GRAIL_PROP_DRAG_Y] = gin_prop_y(gin, m->fm[FM_Y].value); s->nprop = 6; + s->nprop += gin_add_contact_props(gin, s->prop + s->nprop, frame); } static const int fm_mask = 0x03; @@ -77,7 +84,7 @@ int gru_drag(struct grail *ge, } if (!move->single && !(move->active & fm_mask)) return 0; - set_props(state, move); + set_props(ge->gin, state, move, frame); gru_event(ge, state->gid, move, state->prop, state->nprop); return 1; } @@ -118,7 +125,7 @@ int gru_windrag(struct grail *ge, } if (!move->single && !(move->active & fm_mask)) return 0; - set_props(state, move); + set_props(ge->gin, state, move, frame); gru_event(ge, state->gid, move, state->prop, state->nprop); return 1; } -- cgit v1.2.3