Skip to content

Commit f506e78

Browse files
author
Robin Müller
committed
Do not check for gestures if the BTN_LEFT key is active
1 parent 7411d02 commit f506e78

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/gesture_detection.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ uint8_t finger_count;
7979
volatile scroll_t scroll;
8080
gesture_t current_gesture;
8181
double last_zoom_distance;
82+
bool is_click = false;
8283

8384
static int test_grab(int fd) {
8485
int rc;
@@ -113,7 +114,7 @@ static void init_gesture() {
113114
*/
114115
static uint8_t process_key_event(struct input_event event) {
115116
uint8_t finger_count;
116-
if (event.value == 1) {
117+
if (event.value == 1 && !is_click) {
117118
switch (event.code) {
118119
case BTN_TOOL_FINGER:
119120
finger_count = 1;
@@ -130,11 +131,22 @@ static uint8_t process_key_event(struct input_event event) {
130131
case BTN_TOOL_QUINTTAP:
131132
finger_count = 5;
132133
break;
134+
case BTN_LEFT:
135+
is_click = true;
136+
finger_count = 0;
137+
break;
133138
default:
134139
finger_count = 0;
135140
}
136-
} else if (event.value == 0 && event.code == BTN_TOOL_FINGER) {
137-
finger_count = 0;
141+
} else if (event.value == 0) {
142+
switch (event.code) {
143+
case BTN_TOOL_FINGER:
144+
finger_count = 0;
145+
break;
146+
case BTN_LEFT:
147+
is_click = false;
148+
break;
149+
}
138150
}
139151
return finger_count;
140152
}

0 commit comments

Comments
 (0)