Skip to content

Commit 0dede19

Browse files
author
Robin Müller
committed
Also reset the gesture_start.point correctly
1 parent cab6218 commit 0dede19

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/gesture_detection.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ static void reset_point(point_t *p) {
104104
}
105105

106106
static void init_gesture() {
107-
gesture_start.point = mt_slots.points[0];
107+
reset_point(&gesture_start.point);
108108
current_gesture = NO_GESTURE;
109+
reset_point(&mt_slots.points[0]);
110+
reset_point(&mt_slots.points[1]);
111+
reset_point(&mt_slots.last_points[0]);
112+
reset_point(&mt_slots.last_points[1]);
109113

110114
if (finger_count == SCROLL_FINGER_COUNT) {
111115
last_zoom_distance = -1;
112116
scroll.width = 0;
113117
scroll.x_velocity = 0;
114118
scroll.y_velocity = 0;
115-
reset_point(&mt_slots.points[0]);
116-
reset_point(&mt_slots.points[1]);
117-
reset_point(&mt_slots.last_points[0]);
118-
reset_point(&mt_slots.last_points[1]);
119119
}
120120
}
121121

@@ -325,6 +325,8 @@ static input_event_array_t *process_syn_event(struct input_event event,
325325
if (finger_count > 0 && event.code == SYN_REPORT) {
326326
if (!check_mt_slots()) {
327327
return new_input_event_array(0);
328+
} else if (!is_valid_point(gesture_start.point)) {
329+
gesture_start.point = mt_slots.points[0];
328330
}
329331

330332
direction_t direction = NONE;

0 commit comments

Comments
 (0)