diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-04-10 23:18:02 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-04-15 06:10:07 +0200 |
| commit | 030f4fdbe44d1af41c55cdda5baf71ba3225829f (patch) | |
| tree | 8e5c28b70fbdd3fe0ce5a3e55a0b4b39ef65de83 /src/gestures.c | |
| parent | 32d5f821c5bbefc6eae2319209288ec74079529a (diff) | |
Keep logical buttons separate from the hardware ones
The button extraction currently modifies the MTState buttons,
upsetting the semantics in a bad way. This patch adds the logical
button state to the Memory structure, and uses it to compute the
logical button change.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/gestures.c')
| -rw-r--r-- | src/gestures.c | 12 |
1 files changed, 8 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) { |
