summaryrefslogtreecommitdiffstats
path: root/master/marek-e96436b2a69bf3f8e9f85c5dd4acfd203286561e
blob: 8e0f796ff7f6a4e0e33408d2cb2b8e2d9e4e2341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
diff --git a/src/gestures.c b/src/gestures.c
index 9ed2273..c728f10 100644
--- a/src/gestures.c
+++ b/src/gestures.c
@@ -37,21 +37,20 @@ void extract_mouse(struct Gestures *gs, struct MTouch* mt)
 {
 	static int tracking_id = -1;
 
-	if (mt->prev_state.nfinger == 0 && mt->state.nfinger == 1) {
-		// pressed exactly one finger
+	if (tracking_id == -1) {
+		// looking for lmb down
 
-		// lmb pressed
-		tracking_id = mt->state.finger[0].tracking_id;
-		gs->posx = mt->state.finger[0].position_x;
-		gs->posy = mt->state.finger[0].position_y;
-		SETBIT(gs->btmask, MT_BUTTON_LEFT);
-		SETBIT(gs->btdata, MT_BUTTON_LEFT);
-		mt->mem.btdata = BITMASK(MT_BUTTON_LEFT);
+		if (mt->state.nfinger == 1) {
+			// lmb pressed
 
-		return;
-	}
-
-	if (GETBIT(mt->mem.btdata, MT_BUTTON_LEFT)) {
+			tracking_id = mt->state.finger[0].tracking_id;
+			gs->posx = mt->state.finger[0].position_x;
+			gs->posy = mt->state.finger[0].position_y;
+			SETBIT(gs->btmask, MT_BUTTON_LEFT);
+			SETBIT(gs->btdata, MT_BUTTON_LEFT);
+			mt->mem.btdata = BITMASK(MT_BUTTON_LEFT);
+		}
+	} else {
 		// lmb is pressed
 
 		const struct FingerState *finger_state = find_finger(&mt->state, tracking_id);
diff --git a/src/mtouch.c b/src/mtouch.c
index a6b96b8..388d68e 100644
--- a/src/mtouch.c
+++ b/src/mtouch.c
@@ -43,6 +43,10 @@ int open_mtouch(struct MTouch *mt, int fd)
 	init_mtstate(&mt->prev_state);
 	init_mtstate(&mt->state);
 	init_memory(&mt->mem);
+
+	mtdev_set_abs_fuzz(&mt->dev, ABS_MT_POSITION_X, 0);
+	mtdev_set_abs_fuzz(&mt->dev, ABS_MT_POSITION_Y, 0);
+
 	if (use_grab) {
 		SYSCALL(ret = ioctl(fd, EVIOCGRAB, 1));
 		if (ret)
@@ -74,9 +78,9 @@ int read_packet(struct MTouch *mt, int fd)
 	if (ret <= 0)
 		return ret;
 	extract_mtstate(&mt->state, &mt->hs, &mt->caps);
-#if 0
+//#if 0
 	output_mtstate(&mt->state);
-#endif
+//#endif
 	refresh_memory(&mt->mem, &mt->prev_state, &mt->state, &mt->caps);
 #if 0
 	output_memory(&mt->mem);