diff options
Diffstat (limited to 'src/gestures.c')
| -rw-r--r-- | src/gestures.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/gestures.c b/src/gestures.c index 5dd6861..ebf103f 100644 --- a/src/gestures.c +++ b/src/gestures.c | |||
| @@ -25,16 +25,16 @@ | |||
| 25 | 25 | ||
| 26 | void extract_gestures(struct Gestures *gs, struct MTouch* mt) | 26 | void extract_gestures(struct Gestures *gs, struct MTouch* mt) |
| 27 | { | 27 | { |
| 28 | const struct FingerState *b = mt->nhs.finger; | 28 | const struct FingerState *b = mt->state.finger; |
| 29 | const struct FingerState *e = b + mt->nhs.nfinger; | 29 | const struct FingerState *e = b + mt->state.nfinger; |
| 30 | const struct FingerState *p, *fs; | 30 | const struct FingerState *p, *fs; |
| 31 | int nof = count_fingers(&mt->ohs); | 31 | int nof = mt->prev_state.nfinger; |
| 32 | int nsf = count_fingers(&mt->nhs); | 32 | int nsf = mt->state.nfinger; |
| 33 | int dn = 0, i; | 33 | int dn = 0, i; |
| 34 | memset(gs, 0, sizeof(struct Gestures)); | 34 | memset(gs, 0, sizeof(struct Gestures)); |
| 35 | if (nof == nsf) { | 35 | if (nof == nsf) { |
| 36 | for (p = b; p != e; p++) { | 36 | for (p = b; p != e; p++) { |
| 37 | fs = find_finger(&mt->ohs, p->id); | 37 | fs = find_finger(&mt->prev_state, p->id); |
| 38 | if (fs) { | 38 | if (fs) { |
| 39 | gs->dx += p->hw.position_x - fs->hw.position_x; | 39 | gs->dx += p->hw.position_x - fs->hw.position_x; |
| 40 | gs->dy += p->hw.position_y - fs->hw.position_y; | 40 | gs->dy += p->hw.position_y - fs->hw.position_y; |
| @@ -52,14 +52,15 @@ void extract_gestures(struct Gestures *gs, struct MTouch* mt) | |||
| 52 | if (nsf == 3) | 52 | if (nsf == 3) |
| 53 | SETBIT(gs->type, GS_HSCROLL); | 53 | SETBIT(gs->type, GS_HSCROLL); |
| 54 | } | 54 | } |
| 55 | if (mt->nhs.button == BITMASK(MT_BUTTON_LEFT)) { | 55 | if (mt->state.button == BITMASK(MT_BUTTON_LEFT)) { |
| 56 | if (nsf == 2) | 56 | if (nsf == 2) |
| 57 | mt->nhs.button = BITMASK(MT_BUTTON_RIGHT); | 57 | mt->state.button = BITMASK(MT_BUTTON_RIGHT); |
| 58 | if (nsf == 3) | 58 | if (nsf == 3) |
| 59 | mt->nhs.button = BITMASK(MT_BUTTON_MIDDLE); | 59 | mt->state.button = BITMASK(MT_BUTTON_MIDDLE); |
| 60 | } | 60 | } |
| 61 | gs->btmask = (mt->nhs.button ^ mt->ohs.button) & BITONES(DIM_BUTTON); | 61 | gs->btmask = (mt->state.button ^ mt->prev_state.button) & |
| 62 | gs->btdata = mt->nhs.button & BITONES(DIM_BUTTON); | 62 | BITONES(DIM_BUTTON); |
| 63 | mt->ohs = mt->nhs; | 63 | gs->btdata = mt->state.button & BITONES(DIM_BUTTON); |
| 64 | mt->prev_state = mt->state; | ||
| 64 | } | 65 | } |
| 65 | 66 | ||
