@@ -50,6 +50,7 @@ typedef struct gesture_start {
50
50
51
51
mt_slots_t mt_slots ;
52
52
gesture_start_t gesture_start ;
53
+ uint8_t finger_count ;
53
54
54
55
static int test_grab (int fd ) {
55
56
int rc ;
@@ -60,7 +61,7 @@ static int test_grab(int fd) {
60
61
return rc ;
61
62
}
62
63
63
- static void init_gesture (uint8_t finger_count ) {
64
+ static void init_gesture () {
64
65
int32_t x_distance , y_distance ;
65
66
gesture_start .point .x = mt_slots .points [0 ].x ;
66
67
gesture_start .point .y = mt_slots .points [0 ].y ;
@@ -130,10 +131,9 @@ static void set_key_event(struct input_event *key_event, int code, int value) {
130
131
131
132
static input_event_array_t * process_syn_event (struct input_event event ,
132
133
configuration_t config ,
133
- point_t thresholds ,
134
- uint8_t * finger_count ) {
134
+ point_t thresholds ) {
135
135
input_event_array_t * result = NULL ;
136
- if (* finger_count > 0 && event .code == SYN_REPORT ) {
136
+ if (finger_count > 0 && event .code == SYN_REPORT ) {
137
137
direction_t direction = NONE ;
138
138
139
139
int32_t x_distance , y_distance ;
@@ -155,7 +155,7 @@ static input_event_array_t *process_syn_event(struct input_event event,
155
155
if (direction != NONE ) {
156
156
uint8_t i ;
157
157
for (i = MAX_KEYS_PER_GESTURE ; i > 0 ; i -- ) {
158
- int key = config .swipe_keys [FINGER_TO_INDEX (* finger_count )][direction ].keys [i - 1 ];
158
+ int key = config .swipe_keys [FINGER_TO_INDEX (finger_count )][direction ].keys [i - 1 ];
159
159
if (key > 0 ) {
160
160
if (!result ) {
161
161
// i is the number of keys to press
@@ -170,7 +170,7 @@ static input_event_array_t *process_syn_event(struct input_event event,
170
170
set_key_event (& result -> data [result -> length / 2 + i - 1 ], key , 0 );
171
171
}
172
172
}
173
- * finger_count = 0 ;
173
+ finger_count = 0 ;
174
174
}
175
175
}
176
176
return result ? result : new_input_event_array (0 );
@@ -187,7 +187,6 @@ static int32_t get_axix_threshold(int fd, int axis, uint8_t percentage) {
187
187
void process_events (int fd , configuration_t config , void (* callback )(input_event_array_t * )) {
188
188
struct input_event ev [64 ];
189
189
int i , rd ;
190
- uint8_t finger_count ;
191
190
192
191
point_t thresholds ;
193
192
thresholds .x = get_axix_threshold (fd , ABS_X , config .horz_threshold_percentage );
@@ -214,14 +213,14 @@ void process_events(int fd, configuration_t config, void (*callback)(input_event
214
213
case EV_KEY :
215
214
finger_count = process_key_event (ev [i ]);
216
215
if (finger_count > 0 ) {
217
- init_gesture (finger_count );
216
+ init_gesture ();
218
217
}
219
218
break ;
220
219
case EV_ABS :
221
220
process_abs_event (ev [i ]);
222
221
break ;
223
222
case EV_SYN : {
224
- input_event_array_t * input_events = process_syn_event (ev [i ], config , thresholds , & finger_count );
223
+ input_event_array_t * input_events = process_syn_event (ev [i ], config , thresholds );
225
224
callback (input_events );
226
225
free (input_events );
227
226
}
0 commit comments