@@ -49,7 +49,7 @@ typedef struct point {
4949} point_t ;
5050
5151typedef struct mt_slots {
52- uint8_t active ;
52+ unsigned int active ;
5353 point_t points [2 ];
5454 point_t last_points [2 ];
5555} mt_slots_t ;
@@ -67,7 +67,7 @@ typedef struct gesture_start {
6767} gesture_start_t ;
6868
6969typedef struct scroll_thread_params {
70- uint8_t delta ;
70+ unsigned int delta ;
7171 int code ;
7272 bool invert ;
7373 void (* callback )(input_event_array_t * );
@@ -77,7 +77,7 @@ typedef enum gesture { NO_GESTURE, SCROLL, ZOOM, SWIPE } gesture_t;
7777
7878mt_slots_t mt_slots ;
7979gesture_start_t gesture_start ;
80- uint8_t finger_count ;
80+ unsigned int finger_count ;
8181volatile scroll_t scroll ;
8282gesture_t current_gesture ;
8383double last_zoom_distance ;
@@ -93,7 +93,7 @@ static int test_grab(int fd) {
9393}
9494
9595static double calculate_distance (point_t p1 , point_t p2 ) {
96- int32_t x_distance , y_distance ;
96+ int x_distance , y_distance ;
9797 x_distance = p1 .x - p2 .x ;
9898 y_distance = p1 .y - p2 .y ;
9999 return sqrt ((x_distance * x_distance ) + (y_distance * y_distance ));
@@ -123,8 +123,8 @@ static void init_gesture() {
123123/*
124124 * @return number of fingers on touch device
125125 */
126- static uint8_t process_key_event (struct input_event event ) {
127- uint8_t finger_count ;
126+ static unsigned int process_key_event (struct input_event event ) {
127+ unsigned int finger_count ;
128128 if (event .value == 1 && !is_click ) {
129129 switch (event .code ) {
130130 case BTN_TOOL_FINGER :
@@ -166,7 +166,7 @@ static uint8_t process_key_event(struct input_event event) {
166166 * @return velocity in distance per milliseconds
167167 */
168168static double calcualte_velocity (struct input_event event1 , struct input_event event2 ) {
169- int32_t distance = event2 .value - event1 .value ;
169+ int distance = event2 .value - event1 .value ;
170170 double time_delta =
171171 event2 .time .tv_sec * 1000 + event2 .time .tv_usec / 1000 - event1 .time .tv_sec * 1000 - event1 .time .tv_usec / 1000 ;
172172 return distance / time_delta ;
@@ -223,7 +223,7 @@ static void set_input_event(struct input_event *input_event, int type, int code,
223223#define set_key_event (key_event , code , value ) set_input_event(key_event, EV_KEY, code, value)
224224#define set_rel_event (rel_event , code , value ) set_input_event(rel_event, EV_REL, code, value)
225225
226- static input_event_array_t * do_scroll (double distance , int32_t delta , int rel_code , bool invert ) {
226+ static input_event_array_t * do_scroll (double distance , int delta , int rel_code , bool invert ) {
227227 input_event_array_t * result = NULL ;
228228 // increment the scroll width by the current moved distance
229229 scroll .width += distance * (invert ? -1 : 1 );
@@ -239,7 +239,7 @@ static input_event_array_t *do_scroll(double distance, int32_t delta, int rel_co
239239 return result ;
240240}
241241
242- static input_event_array_t * do_zoom (double distance , int32_t delta ) {
242+ static input_event_array_t * do_zoom (double distance , int delta ) {
243243 input_event_array_t * result = NULL ;
244244 input_event_array_t * tmp = do_scroll (distance , delta , REL_WHEEL , false);
245245 if (tmp ) {
@@ -320,7 +320,7 @@ static bool check_mt_slots() {
320320 return result ;
321321}
322322
323- uint32_t syn_counter = 0 ;
323+ unsigned int syn_counter = 0 ;
324324
325325static input_event_array_t * process_syn_event (struct input_event event ,
326326 configuration_t config ,
@@ -354,7 +354,7 @@ static input_event_array_t *process_syn_event(struct input_event event,
354354 }
355355 last_zoom_distance = finger_distance ;
356356 } else {
357- int32_t x_distance , y_distance ;
357+ int x_distance , y_distance ;
358358 x_distance = gesture_start .point .x - mt_slots .points [0 ].x ;
359359 y_distance = gesture_start .point .y - mt_slots .points [0 ].y ;
360360 if (fabs (x_distance ) > fabs (y_distance )) {
@@ -388,7 +388,7 @@ static input_event_array_t *process_syn_event(struct input_event event,
388388 }
389389 }
390390 if (direction != NONE ) {
391- uint8_t i ;
391+ unsigned int i ;
392392 for (i = MAX_KEYS_PER_GESTURE ; i > 0 ; i -- ) {
393393 int key = config .swipe_keys [FINGER_TO_INDEX (finger_count )][direction ].keys [i - 1 ];
394394 if (key > 0 ) {
@@ -411,15 +411,15 @@ static input_event_array_t *process_syn_event(struct input_event event,
411411 return result ? result : new_input_event_array (0 );
412412}
413413
414- static int32_t get_axix_threshold (int fd , int axis , uint8_t percentage ) {
414+ static int get_axix_threshold (int fd , int axis , unsigned int percentage ) {
415415 struct input_absinfo absinfo ;
416416 if (ioctl (fd , EVIOCGABS (axis ), & absinfo ) < 0 ) {
417417 return -1 ;
418418 }
419419 return (absinfo .maximum - absinfo .minimum ) * percentage / 100 ;
420420}
421421
422- static int32_t get_axix_offset (int fd , int axis ) {
422+ static int get_axix_offset (int fd , int axis ) {
423423 struct input_absinfo absinfo ;
424424 if (ioctl (fd , EVIOCGABS (axis ), & absinfo ) < 0 ) {
425425 return -1 ;
@@ -472,7 +472,7 @@ void process_events(int fd, configuration_t config, void (*callback)(input_event
472472 offsets .x = get_axix_offset (fd , ABS_X );
473473 offsets .y = get_axix_offset (fd , ABS_Y );
474474
475- pthread_t scroll_thread = NULL ;
475+ pthread_t scroll_thread = ( pthread_t ) NULL ;
476476
477477 if (thresholds .x < 0 || thresholds .y < 0 ) {
478478 return ;
0 commit comments