31
31
32
32
#include "gesture_detection.h"
33
33
34
- struct point_t {
34
+ typedef struct point {
35
35
int x ;
36
36
int y ;
37
- };
37
+ } point_t ;
38
38
39
- struct mt_slots_t {
39
+ typedef struct mt_slots {
40
40
uint8_t active ;
41
- struct point_t points [2 ];
42
- };
41
+ point_t points [2 ];
42
+ } mt_slots_t ;
43
43
44
- struct gesture_start_t {
45
- struct point_t point ;
44
+ typedef struct gesture_start {
45
+ point_t point ;
46
46
uint32_t distance ;
47
- };
47
+ } gesture_start_t ;
48
48
49
- enum direction_t { UP , DOWN , LEFT , RIGHT , NONE };
49
+ typedef enum direction { UP , DOWN , LEFT , RIGHT , NONE } direction_t ;
50
50
51
51
static int test_grab (int fd ) {
52
52
int rc ;
@@ -57,9 +57,9 @@ static int test_grab(int fd) {
57
57
return rc ;
58
58
}
59
59
60
- static void init_gesture (struct point_t slot_points [2 ],
60
+ static void init_gesture (point_t slot_points [2 ],
61
61
uint8_t finger_count ,
62
- struct gesture_start_t * gesture_start ) {
62
+ gesture_start_t * gesture_start ) {
63
63
int32_t x_distance , y_distance ;
64
64
gesture_start -> point .x = slot_points [0 ].x ;
65
65
gesture_start -> point .y = slot_points [0 ].y ;
@@ -100,7 +100,7 @@ static uint8_t process_key_event(struct input_event event) {
100
100
}
101
101
102
102
static void process_abs_event (struct input_event event ,
103
- struct mt_slots_t * mt_slots ) {
103
+ mt_slots_t * mt_slots ) {
104
104
if (event .code == ABS_MT_SLOT ) {
105
105
mt_slots -> active = event .value ;
106
106
} else if (mt_slots -> active < 2 ) {
@@ -117,12 +117,12 @@ static void process_abs_event(struct input_event event,
117
117
118
118
static void process_syn_event (struct input_event event ,
119
119
configuration_t config ,
120
- struct gesture_start_t gesture_start ,
121
- struct point_t slot_points [2 ],
122
- struct point_t thresholds ,
120
+ gesture_start_t gesture_start ,
121
+ point_t slot_points [2 ],
122
+ point_t thresholds ,
123
123
uint8_t * finger_count ) {
124
124
if (* finger_count > 0 && event .code == SYN_REPORT ) {
125
- enum direction_t direction = NONE ;
125
+ direction_t direction = NONE ;
126
126
127
127
int32_t x_distance , y_distance ;
128
128
x_distance = gesture_start .point .x - slot_points [0 ].x ;
@@ -160,10 +160,10 @@ void process_events(int fd, configuration_t config) {
160
160
struct input_event ev [64 ];
161
161
int i , rd ;
162
162
uint8_t finger_count ;
163
- struct gesture_start_t gesture_start ;
164
- struct mt_slots_t mt_slots ;
163
+ gesture_start_t gesture_start ;
164
+ mt_slots_t mt_slots ;
165
165
166
- struct point_t thresholds ;
166
+ point_t thresholds ;
167
167
thresholds .x = get_axix_threshold (fd , ABS_X , 20 );
168
168
thresholds .y = get_axix_threshold (fd , ABS_Y , 20 );
169
169
0 commit comments