diff options
| author | Henrik Rydberg <rydberg@alnilam.(none)> | 2010-02-01 20:26:21 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@alnilam.(none)> | 2010-02-01 20:44:43 +0100 |
| commit | 011634a6f8df4fb6b6c24dc173680b96c7fb16f1 (patch) | |
| tree | f2f68a110978e9e4049582791ef14ff2c5ff3cf9 /src/gestures.c | |
| parent | 0571c36648079b79cb38c9969c865cd9f982aef4 (diff) | |
button: simplify button handling
Make better use of the bit representation, reducing one
layer of conversion.
Diffstat (limited to 'src/gestures.c')
| -rw-r--r-- | src/gestures.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/gestures.c b/src/gestures.c index 89dad1a..0b0ba1d 100644 --- a/src/gestures.c +++ b/src/gestures.c | |||
| @@ -57,14 +57,8 @@ void extract_gestures(struct Gestures *gs, struct MTouch* mt) | |||
| 57 | if (nsf == 3) | 57 | if (nsf == 3) |
| 58 | mt->ns.button = BITMASK(MT_BUTTON_MIDDLE); | 58 | mt->ns.button = BITMASK(MT_BUTTON_MIDDLE); |
| 59 | } | 59 | } |
| 60 | for (i = 0; i < DIM_BUTTON; i++) { | 60 | gs->btmask = (mt->ns.button ^ mt->os.button) & BITONES(DIM_BUTTON); |
| 61 | if (GETBIT(mt->ns.button, i) != GETBIT(mt->os.button, i)) { | 61 | gs->btdata = mt->ns.button & BITONES(DIM_BUTTON); |
| 62 | SETBIT(gs->type, GS_BUTTON); | ||
| 63 | gs->btix[gs->nbt] = i + 1; | ||
| 64 | gs->btval[gs->nbt] = GETBIT(mt->ns.button, i); | ||
| 65 | gs->nbt++; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | mt->os = mt->ns; | 62 | mt->os = mt->ns; |
| 69 | } | 63 | } |
| 70 | 64 | ||
