diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gestures.c | 12 | ||||
| -rw-r--r-- | src/memory.c | 1 | ||||
| -rw-r--r-- | src/memory.h | 1 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/gestures.c b/src/gestures.c index c837d6c..e032214 100644 --- a/src/gestures.c +++ b/src/gestures.c | |||
| @@ -50,16 +50,20 @@ static void extract_movement(struct Gestures *gs, struct MTouch* mt) | |||
| 50 | 50 | ||
| 51 | static void extract_buttons(struct Gestures *gs, struct MTouch* mt) | 51 | static void extract_buttons(struct Gestures *gs, struct MTouch* mt) |
| 52 | { | 52 | { |
| 53 | unsigned btdata = mt->state.button & BITONES(DIM_BUTTON); | ||
| 53 | if (mt->state.button == BITMASK(MT_BUTTON_LEFT)) { | 54 | if (mt->state.button == BITMASK(MT_BUTTON_LEFT)) { |
| 54 | if (mt->state.nfinger == 2) | 55 | if (mt->state.nfinger == 2) |
| 55 | mt->state.button = BITMASK(MT_BUTTON_RIGHT); | 56 | btdata = BITMASK(MT_BUTTON_RIGHT); |
| 56 | if (mt->state.nfinger == 3) | 57 | if (mt->state.nfinger == 3) |
| 57 | mt->state.button = BITMASK(MT_BUTTON_MIDDLE); | 58 | btdata = BITMASK(MT_BUTTON_MIDDLE); |
| 58 | } | 59 | } |
| 59 | gs->btmask = (mt->state.button ^ mt->prev_state.button) & BITONES(DIM_BUTTON); | 60 | gs->btmask = (btdata ^ mt->mem.btdata) & BITONES(DIM_BUTTON); |
| 60 | gs->btdata = mt->state.button & BITONES(DIM_BUTTON); | 61 | gs->btdata = btdata; |
| 62 | mt->mem.btdata = btdata; | ||
| 61 | } | 63 | } |
| 62 | 64 | ||
| 65 | /******************************************************/ | ||
| 66 | |||
| 63 | static void extract_type(struct Gestures *gs, struct MTouch* mt) | 67 | static void extract_type(struct Gestures *gs, struct MTouch* mt) |
| 64 | { | 68 | { |
| 65 | if (gs->dx || gs->dy) { | 69 | if (gs->dx || gs->dy) { |
diff --git a/src/memory.c b/src/memory.c index 6b502d8..b213694 100644 --- a/src/memory.c +++ b/src/memory.c | |||
| @@ -23,4 +23,5 @@ | |||
| 23 | 23 | ||
| 24 | void init_memory(struct Memory *mem) | 24 | void init_memory(struct Memory *mem) |
| 25 | { | 25 | { |
| 26 | memset(mem, 0, sizeof(struct Memory)); | ||
| 26 | } | 27 | } |
diff --git a/src/memory.h b/src/memory.h index 46dd312..a6c51ec 100644 --- a/src/memory.h +++ b/src/memory.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include "mtstate.h" | 25 | #include "mtstate.h" |
| 26 | 26 | ||
| 27 | struct Memory { | 27 | struct Memory { |
| 28 | unsigned btdata; | ||
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| 30 | void init_memory(struct Memory *mem); | 31 | void init_memory(struct Memory *mem); |
