From 753a645f463f2d72234554bc211cc32f65129929 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 15 Jun 2010 20:32:14 +0200 Subject: refactor: Use the bitmask_t type Use the bitmask_t for all bitfields, to simplify future expansions to larger bit fields. Signed-off-by: Henrik Rydberg --- include/gestures.h | 2 +- include/hwstate.h | 2 +- include/memory.h | 6 +++--- include/mtstate.h | 2 +- src/gestures.c | 2 +- src/memory.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/gestures.h b/include/gestures.h index 2866ba4..2bd4a55 100644 --- a/include/gestures.h +++ b/include/gestures.h @@ -34,7 +34,7 @@ #define GS_ROTATE 7 struct Gestures { - unsigned type, btmask, btdata; + bitmask_t type, btmask, btdata; int same_fingers, dx, dy, scale, rot; }; diff --git a/include/hwstate.h b/include/hwstate.h index 76ed016..07d4ed6 100644 --- a/include/hwstate.h +++ b/include/hwstate.h @@ -33,7 +33,7 @@ struct FingerState { struct HWState { struct FingerState finger[DIM_FINGER]; - unsigned button; + bitmask_t button; int nfinger; mstime_t evtime; int lastid; diff --git a/include/memory.h b/include/memory.h index 8ffbdab..1a1b688 100644 --- a/include/memory.h +++ b/include/memory.h @@ -43,9 +43,9 @@ * */ struct Memory { - unsigned btdata, same; - unsigned fingers, added, thumb; - unsigned pointing, pending, moving; + bitmask_t btdata, same; + bitmask_t fingers, added, thumb; + bitmask_t pointing, pending, moving; int ybar; mstime_t mvhold, mvforget; int dx[DIM_FINGER], dy[DIM_FINGER]; diff --git a/include/mtstate.h b/include/mtstate.h index b5f5dd1..b6b8e8d 100644 --- a/include/mtstate.h +++ b/include/mtstate.h @@ -32,7 +32,7 @@ struct MTFinger { struct MTState { struct MTFinger finger[DIM_FINGER]; int nfinger; - unsigned button; + bitmask_t button; mstime_t evtime; }; diff --git a/src/gestures.c b/src/gestures.c index 2dafe79..0cc2e0b 100644 --- a/src/gestures.c +++ b/src/gestures.c @@ -38,7 +38,7 @@ static const int BUTTON_HOLD_MS = 200; */ static void extract_buttons(struct Gestures *gs, struct MTouch* mt) { - unsigned btdata = mt->state.button & BITONES(DIM_BUTTON); + bitmask_t btdata = mt->state.button & BITONES(DIM_BUTTON); int npoint = bitcount(mt->mem.pointing); if (mt->state.button == BITMASK(MT_BUTTON_LEFT)) { if (npoint == 2) diff --git a/src/memory.c b/src/memory.c index 39621da..4cfb7da 100644 --- a/src/memory.c +++ b/src/memory.c @@ -61,7 +61,7 @@ static void update_configuration(struct Memory *m, const struct MTState *state) { const struct MTFinger *f = state->finger; - unsigned fingers = BITONES(state->nfinger); + bitmask_t fingers = BITONES(state->nfinger); int i; m->added = 0; foreach_bit(i, fingers) -- cgit v1.2.3