summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common.h8
-rw-r--r--src/gestures.c6
2 files changed, 8 insertions, 6 deletions
diff --git a/src/common.h b/src/common.h
index f9d9f77..b1c3273 100644
--- a/src/common.h
+++ b/src/common.h
@@ -54,9 +54,11 @@
54 54
55#define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) 55#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
56 56
57#define GETBIT(m, x) ((m>>(x))&1U) 57#define BITMASK(x) (1U << (x))
58#define SETBIT(m, x) (m|=(1U<<(x))) 58#define BITONES(x) (BITMASK(x) - 1U)
59#define CLEARBIT(m, x) (m&=~(1U<<(x))) 59#define GETBIT(m, x) (((m) >> (x)) & 1U)
60#define SETBIT(m, x) (m |= BITMASK(x))
61#define CLEARBIT(m, x) (m &= ~BITMASK(x))
60 62
61//////////////////////////////////////////////////////// 63////////////////////////////////////////////////////////
62 64
diff --git a/src/gestures.c b/src/gestures.c
index 8ba32f3..89dad1a 100644
--- a/src/gestures.c
+++ b/src/gestures.c
@@ -51,11 +51,11 @@ void extract_gestures(struct Gestures *gs, struct MTouch* mt)
51 if (nsf == 3) 51 if (nsf == 3)
52 SETBIT(gs->type, GS_HSCROLL); 52 SETBIT(gs->type, GS_HSCROLL);
53 } 53 }
54 if (mt->ns.button == (1U << MT_BUTTON_LEFT)) { 54 if (mt->ns.button == BITMASK(MT_BUTTON_LEFT)) {
55 if (nsf == 2) 55 if (nsf == 2)
56 mt->ns.button = (1U << MT_BUTTON_RIGHT); 56 mt->ns.button = BITMASK(MT_BUTTON_RIGHT);
57 if (nsf == 3) 57 if (nsf == 3)
58 mt->ns.button = (1U << MT_BUTTON_MIDDLE); 58 mt->ns.button = BITMASK(MT_BUTTON_MIDDLE);
59 } 59 }
60 for (i = 0; i < DIM_BUTTON; i++) { 60 for (i = 0; i < DIM_BUTTON; i++) {
61 if (GETBIT(mt->ns.button, i) != GETBIT(mt->os.button, i)) { 61 if (GETBIT(mt->ns.button, i) != GETBIT(mt->os.button, i)) {