Skip to content

Commit 7584456

Browse files
author
Robin Müller
committed
Use typedef for all structs and enums
1 parent c46235a commit 7584456

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/gesture_detection.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@
3131

3232
#include "gesture_detection.h"
3333

34-
struct point_t {
34+
typedef struct point {
3535
int x;
3636
int y;
37-
};
37+
} point_t;
3838

39-
struct mt_slots_t {
39+
typedef struct mt_slots {
4040
uint8_t active;
41-
struct point_t points[2];
42-
};
41+
point_t points[2];
42+
} mt_slots_t;
4343

44-
struct gesture_start_t {
45-
struct point_t point;
44+
typedef struct gesture_start {
45+
point_t point;
4646
uint32_t distance;
47-
};
47+
} gesture_start_t;
4848

49-
enum direction_t { UP, DOWN, LEFT, RIGHT, NONE };
49+
typedef enum direction { UP, DOWN, LEFT, RIGHT, NONE } direction_t;
5050

5151
static int test_grab(int fd) {
5252
int rc;
@@ -57,9 +57,9 @@ static int test_grab(int fd) {
5757
return rc;
5858
}
5959

60-
static void init_gesture(struct point_t slot_points[2],
60+
static void init_gesture(point_t slot_points[2],
6161
uint8_t finger_count,
62-
struct gesture_start_t *gesture_start) {
62+
gesture_start_t *gesture_start) {
6363
int32_t x_distance, y_distance;
6464
gesture_start->point.x = slot_points[0].x;
6565
gesture_start->point.y = slot_points[0].y;
@@ -100,7 +100,7 @@ static uint8_t process_key_event(struct input_event event) {
100100
}
101101

102102
static void process_abs_event(struct input_event event,
103-
struct mt_slots_t *mt_slots) {
103+
mt_slots_t *mt_slots) {
104104
if (event.code == ABS_MT_SLOT) {
105105
mt_slots->active = event.value;
106106
} else if (mt_slots->active < 2) {
@@ -117,12 +117,12 @@ static void process_abs_event(struct input_event event,
117117

118118
static void process_syn_event(struct input_event event,
119119
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,
123123
uint8_t *finger_count) {
124124
if (*finger_count > 0 && event.code == SYN_REPORT) {
125-
enum direction_t direction = NONE;
125+
direction_t direction = NONE;
126126

127127
int32_t x_distance, y_distance;
128128
x_distance = gesture_start.point.x - slot_points[0].x;
@@ -160,10 +160,10 @@ void process_events(int fd, configuration_t config) {
160160
struct input_event ev[64];
161161
int i, rd;
162162
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;
165165

166-
struct point_t thresholds;
166+
point_t thresholds;
167167
thresholds.x = get_axix_threshold(fd, ABS_X, 20);
168168
thresholds.y = get_axix_threshold(fd, ABS_Y, 20);
169169

0 commit comments

Comments
 (0)