From 3d9590231e55d33e2e9fc7aa58f296ebc941bf7e Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Thu, 1 Apr 2021 14:49:35 -0400 Subject: [PATCH] elput: Fix formatting NB: No functional changes, just fixing formatting to match the rest of the library --- src/lib/elput/elput_gestures.c | 35 +++++++++++++++++++++------------- src/lib/elput/elput_input.c | 15 ++++++++++----- src/lib/elput/elput_private.h | 12 +++++++----- src/lib/elput/elput_root.c | 14 +++++++++----- 4 files changed, 48 insertions(+), 28 deletions(-) diff --git a/src/lib/elput/elput_gestures.c b/src/lib/elput/elput_gestures.c index baa67e9519..120297194f 100644 --- a/src/lib/elput/elput_gestures.c +++ b/src/lib/elput/elput_gestures.c @@ -17,12 +17,11 @@ ACCESSOR(swipe, device, Elput_Device*, NULL) EAPI Elput_Manager* elput_manager_connect_gestures(const char *seat, unsigned int tty) { - Elput_Manager *em = elput_manager_connect(seat, tty); + Elput_Manager *em; + em = elput_manager_connect(seat, tty); if (em) - { - em->only_gesture_events = EINA_TRUE; - } + em->only_gesture_events = EINA_TRUE; return em; } @@ -30,19 +29,26 @@ elput_manager_connect_gestures(const char *seat, unsigned int tty) static void _free_and_unref_device(void *userdata EINA_UNUSED, void *data) { - Elput_Swipe_Gesture *gesture = data; - libinput_device_unref(gesture->device->device); - free(gesture); + Elput_Swipe_Gesture *gesture; + + gesture = data; + libinput_device_unref(gesture->device->device); + free(gesture); } static void _eval_callback(int event, struct libinput_device *device, struct libinput_event_gesture *gesture) { - Elput_Device *dev = libinput_device_get_user_data(device); - Elput_Swipe_Gesture *elput_gesture = calloc(1, sizeof(Elput_Swipe_Gesture)); + Elput_Device *dev; + Elput_Swipe_Gesture *elput_gesture; + + dev = libinput_device_get_user_data(device); + elput_gesture = calloc(1, sizeof(Elput_Swipe_Gesture)); + elput_gesture->dx = libinput_event_gesture_get_dx(gesture); elput_gesture->dy = libinput_event_gesture_get_dy(gesture); - elput_gesture->finger_count = libinput_event_gesture_get_finger_count(gesture); + elput_gesture->finger_count = + libinput_event_gesture_get_finger_count(gesture); elput_gesture->window = dev->seat->manager->window; elput_gesture->device = dev; @@ -61,13 +67,16 @@ _gesture_event_process(struct libinput_event *event) switch (libinput_event_get_type(event)) { case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: - _eval_callback(ELPUT_EVENT_SWIPE_BEGIN, dev, libinput_event_get_gesture_event(event)); + _eval_callback(ELPUT_EVENT_SWIPE_BEGIN, dev, + libinput_event_get_gesture_event(event)); break; case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: - _eval_callback(ELPUT_EVENT_SWIPE_UPDATE, dev, libinput_event_get_gesture_event(event)); + _eval_callback(ELPUT_EVENT_SWIPE_UPDATE, dev, + libinput_event_get_gesture_event(event)); break; case LIBINPUT_EVENT_GESTURE_SWIPE_END: - _eval_callback(ELPUT_EVENT_SWIPE_END, dev, libinput_event_get_gesture_event(event)); + _eval_callback(ELPUT_EVENT_SWIPE_END, dev, + libinput_event_get_gesture_event(event)); break; default: ret = 0; diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c index 1ec339fb4e..4005a43cdb 100644 --- a/src/lib/elput/elput_input.c +++ b/src/lib/elput/elput_input.c @@ -315,8 +315,9 @@ static void _process_events(Elput_Manager *em) { struct libinput_event *event; - Elput_Input *ei = &em->input; + Elput_Input *ei; + ei = &em->input; while ((ei->lib) && (event = libinput_get_event(ei->lib))) { _process_event(em, event); @@ -342,8 +343,9 @@ _cb_input_dispatch(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED) static void _elput_input_init_cancel(void *data, Ecore_Thread *eth EINA_UNUSED) { - Elput_Manager *manager = data; + Elput_Manager *manager; + manager = data; manager->input.thread = NULL; if (manager->input.current_pending) { @@ -358,8 +360,9 @@ _elput_input_init_cancel(void *data, Ecore_Thread *eth EINA_UNUSED) static void _elput_input_init_end(void *data, Ecore_Thread *eth EINA_UNUSED) { - Elput_Manager *manager = data; + Elput_Manager *manager; + manager = data; manager->input.thread = NULL; if (!manager->input.lib) return; @@ -389,8 +392,9 @@ _elput_input_init_end(void *data, Ecore_Thread *eth EINA_UNUSED) static void _elput_input_init_notify(void *data EINA_UNUSED, Ecore_Thread *eth EINA_UNUSED, void *msg_data) { - Elput_Async_Open *ao = msg_data; + Elput_Async_Open *ao; + ao = msg_data; ao->manager->interface->open_async(ao->manager, ao->path, ao->flags); free(ao->path); free(ao); @@ -399,9 +403,10 @@ _elput_input_init_notify(void *data EINA_UNUSED, Ecore_Thread *eth EINA_UNUSED, static void _elput_input_init_thread(void *data, Ecore_Thread *eth EINA_UNUSED) { - Elput_Manager *manager = data; + Elput_Manager *manager; struct udev *udev; + manager = data; udev = udev_new(); manager->input.lib = diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h index 9c613d9d57..9dab95140a 100644 --- a/src/lib/elput/elput_private.h +++ b/src/lib/elput/elput_private.h @@ -56,6 +56,7 @@ extern int _elput_log_dom; # endif # define CRIT(...) EINA_LOG_DOM_CRIT(_elput_log_dom, __VA_ARGS__) #endif + typedef struct _Elput_Interface { Eina_Bool (*connect)(Elput_Manager **manager, const char *seat, unsigned int tty); @@ -246,11 +247,12 @@ struct _Elput_Device Eina_Bool invert_y : 1; }; -struct _Elput_Swipe_Gesture { - double dx, dy; - int finger_count; - int window; - Elput_Device *device; +struct _Elput_Swipe_Gesture +{ + double dx, dy; + int finger_count; + int window; + Elput_Device *device; }; struct _Elput_Manager diff --git a/src/lib/elput/elput_root.c b/src/lib/elput/elput_root.c index f07d46d0b1..3d69dc0e3e 100644 --- a/src/lib/elput/elput_root.c +++ b/src/lib/elput/elput_root.c @@ -12,11 +12,15 @@ static Eina_Bool _user_part_of_input(void) { - uid_t user = getuid(); - struct passwd *user_pw = getpwuid(user); + uid_t user; + struct passwd *user_pw; gid_t *gids = NULL; int number_of_groups = 0; - struct group *input_group = getgrnam("input"); + struct group *input_group; + + user = getuid(); + user_pw = getpwuid(user); + input_group = getgrnam("input"); EINA_SAFETY_ON_NULL_RETURN_VAL(user_pw, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(input_group, EINA_FALSE); @@ -104,9 +108,9 @@ err: static void _root_open_async(Elput_Manager *em, const char *path, int flags) { - int fd = _root_open(em, path, flags); - int ret; + int fd, ret; + fd = _root_open(em, path, flags); while (1) { ret = write(em->input.pipe, &fd, sizeof(int));