diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-08-19 22:15:55 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-08-19 22:15:55 +0200 |
| commit | 76f51a7675801acfe8e58c6a21192668d23d3320 (patch) | |
| tree | 73109e613e93fbb8f20fabdbec9f7e0d5356f4dd /src/gestures-pinch.c | |
| parent | 8331322a0fec7277366a29a970eafbb795c08432 (diff) | |
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 <rydberg@euromail.se>
Diffstat (limited to 'src/gestures-pinch.c')
| -rw-r--r-- | src/gestures-pinch.c | 23 |
1 files changed, 8 insertions, 15 deletions
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] = { | |||
| 35 | 35 | ||
| 36 | static const int fm_mask = 0x04; | 36 | static const int fm_mask = 0x04; |
| 37 | 37 | ||
| 38 | static void set_props(struct combo_model *s, | 38 | static void set_props(const struct gesture_inserter *gin, |
| 39 | struct combo_model *s, | ||
| 39 | const struct move_model *m, | 40 | const struct move_model *m, |
| 40 | const struct touch_frame *frame) | 41 | const struct touch_frame *frame) |
| 41 | { | 42 | { |
| 42 | struct grail_coord min, max; | 43 | s->prop[GRAIL_PROP_PINCH_DR] = gin->scale_r * m->fm[FM_R].action_delta; |
| 43 | s->prop[GRAIL_PROP_PINCH_DR] = m->fm[FM_R].action_delta; | 44 | s->prop[GRAIL_PROP_PINCH_VR] = gin->scale_r * m->fm[FM_R].velocity; |
| 44 | s->prop[GRAIL_PROP_PINCH_VR] = m->fm[FM_R].velocity; | 45 | s->prop[GRAIL_PROP_PINCH_R] = gin->scale_r * m->fm[FM_R].value; |
| 45 | s->prop[GRAIL_PROP_PINCH_R] = m->fm[FM_R].value; | ||
| 46 | s->nprop = 3; | 46 | s->nprop = 3; |
| 47 | if (!frame->nactive) | 47 | s->nprop += gin_add_contact_props(gin, s->prop + s->nprop, frame); |
| 48 | return; | ||
| 49 | gru_compute_bbox(&min, &max, frame); | ||
| 50 | s->prop[GRAIL_PROP_PINCH_X1] = min.x; | ||
| 51 | s->prop[GRAIL_PROP_PINCH_Y1] = min.y; | ||
| 52 | s->prop[GRAIL_PROP_PINCH_X2] = max.x; | ||
| 53 | s->prop[GRAIL_PROP_PINCH_Y2] = max.y; | ||
| 54 | s->nprop = 7; | ||
| 55 | } | 48 | } |
| 56 | 49 | ||
| 57 | int gru_pinch(struct grail *ge, | 50 | int gru_pinch(struct grail *ge, |
| @@ -80,7 +73,7 @@ int gru_pinch(struct grail *ge, | |||
| 80 | } | 73 | } |
| 81 | if (!(move->active & fm_mask)) | 74 | if (!(move->active & fm_mask)) |
| 82 | return 0; | 75 | return 0; |
| 83 | set_props(state, move, frame); | 76 | set_props(ge->gin, state, move, frame); |
| 84 | gru_event(ge, state->gid, move, state->prop, state->nprop); | 77 | gru_event(ge, state->gid, move, state->prop, state->nprop); |
| 85 | return 1; | 78 | return 1; |
| 86 | } | 79 | } |
| @@ -121,7 +114,7 @@ int gru_winpinch(struct grail *ge, | |||
| 121 | } | 114 | } |
| 122 | if (!(move->active & fm_mask)) | 115 | if (!(move->active & fm_mask)) |
| 123 | return 0; | 116 | return 0; |
| 124 | set_props(state, move, frame); | 117 | set_props(ge->gin, state, move, frame); |
| 125 | gru_event(ge, state->gid, move, state->prop, state->nprop); | 118 | gru_event(ge, state->gid, move, state->prop, state->nprop); |
| 126 | return 1; | 119 | return 1; |
| 127 | } | 120 | } |
