summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gestures.c10
-rw-r--r--src/gestures.h2
-rw-r--r--src/multitouch.c13
3 files changed, 10 insertions, 15 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
diff --git a/src/gestures.h b/src/gestures.h
index 4b2d948..f83cae2 100644
--- a/src/gestures.h
+++ b/src/gestures.h
@@ -37,7 +37,7 @@
37struct Gestures { 37struct Gestures {
38 unsigned type; 38 unsigned type;
39 int dx, dy; 39 int dx, dy;
40 int nbt, btix[DIM_BUTTON], btval[DIM_BUTTON]; 40 button_t btmask, btdata;
41}; 41};
42 42
43//////////////////////////////////////////////////////// 43////////////////////////////////////////////////////////
diff --git a/src/multitouch.c b/src/multitouch.c
index f6e5305..fa966ce 100644
--- a/src/multitouch.c
+++ b/src/multitouch.c
@@ -231,12 +231,13 @@ static void handle_gestures(LocalDevicePtr local,
231 int hstep = 1 + 231 int hstep = 1 +
232 hscroll_fraction * (caps->abs_position_x.maximum - 232 hscroll_fraction * (caps->abs_position_x.maximum -
233 caps->abs_position_x.minimum); 233 caps->abs_position_x.minimum);
234 int i; 234 int i;
235 for (i = 0; i < gs->nbt; i++) { 235 for (i = 0; i < DIM_BUTTON; i++) {
236 xf86PostButtonEvent(local->dev, FALSE, 236 if (GETBIT(gs->btmask, i)) {
237 gs->btix[i], gs->btval[i], 237 xf86PostButtonEvent(local->dev, FALSE,
238 0, 0); 238 i + 1, GETBIT(gs->btdata, i), 0, 0);
239 TRACE2("button: %d %d\n", gs->btix[i], gs->btval[i]); 239 TRACE2("button bit: %d %d\n", i, GETBIT(gs->btdata, i));
240 }
240 } 241 }
241 if (GETBIT(gs->type, GS_MOVE)) { 242 if (GETBIT(gs->type, GS_MOVE)) {
242 xf86PostMotionEvent(local->dev, 0, 0, 2, 243 xf86PostMotionEvent(local->dev, 0, 0, 2,