summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Michael <devilhorns@comcast.net>2021-04-01 14:49:35 -0400
committerChristopher Michael <devilhorns@comcast.net>2021-04-01 14:49:35 -0400
commit3d9590231e55d33e2e9fc7aa58f296ebc941bf7e (patch)
tree91fae819b87dbedffc8956b498ff87d44e954a46 /src
parentc4128bd5809456d605aef731c7d81c0d8906e855 (diff)
elput: Fix formatting
NB: No functional changes, just fixing formatting to match the rest of the library
Diffstat (limited to 'src')
-rw-r--r--src/lib/elput/elput_gestures.c35
-rw-r--r--src/lib/elput/elput_input.c15
-rw-r--r--src/lib/elput/elput_private.h12
-rw-r--r--src/lib/elput/elput_root.c14
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)
17EAPI Elput_Manager* 17EAPI Elput_Manager*
18elput_manager_connect_gestures(const char *seat, unsigned int tty) 18elput_manager_connect_gestures(const char *seat, unsigned int tty)
19{ 19{
20 Elput_Manager *em = elput_manager_connect(seat, tty); 20 Elput_Manager *em;
21 21
22 em = elput_manager_connect(seat, tty);
22 if (em) 23 if (em)
23 { 24 em->only_gesture_events = EINA_TRUE;
24 em->only_gesture_events = EINA_TRUE;
25 }
26 25
27 return em; 26 return em;
28} 27}
@@ -30,19 +29,26 @@ elput_manager_connect_gestures(const char *seat, unsigned int tty)
30static void 29static void
31_free_and_unref_device(void *userdata EINA_UNUSED, void *data) 30_free_and_unref_device(void *userdata EINA_UNUSED, void *data)
32{ 31{
33 Elput_Swipe_Gesture *gesture = data; 32 Elput_Swipe_Gesture *gesture;
34 libinput_device_unref(gesture->device->device); 33
35 free(gesture); 34 gesture = data;
35 libinput_device_unref(gesture->device->device);
36 free(gesture);
36} 37}
37 38
38static void 39static void
39_eval_callback(int event, struct libinput_device *device, struct libinput_event_gesture *gesture) 40_eval_callback(int event, struct libinput_device *device, struct libinput_event_gesture *gesture)
40{ 41{
41 Elput_Device *dev = libinput_device_get_user_data(device); 42 Elput_Device *dev;
42 Elput_Swipe_Gesture *elput_gesture = calloc(1, sizeof(Elput_Swipe_Gesture)); 43 Elput_Swipe_Gesture *elput_gesture;
44
45 dev = libinput_device_get_user_data(device);
46 elput_gesture = calloc(1, sizeof(Elput_Swipe_Gesture));
47
43 elput_gesture->dx = libinput_event_gesture_get_dx(gesture); 48 elput_gesture->dx = libinput_event_gesture_get_dx(gesture);
44 elput_gesture->dy = libinput_event_gesture_get_dy(gesture); 49 elput_gesture->dy = libinput_event_gesture_get_dy(gesture);
45 elput_gesture->finger_count = libinput_event_gesture_get_finger_count(gesture); 50 elput_gesture->finger_count =
51 libinput_event_gesture_get_finger_count(gesture);
46 elput_gesture->window = dev->seat->manager->window; 52 elput_gesture->window = dev->seat->manager->window;
47 elput_gesture->device = dev; 53 elput_gesture->device = dev;
48 54
@@ -61,13 +67,16 @@ _gesture_event_process(struct libinput_event *event)
61 switch (libinput_event_get_type(event)) 67 switch (libinput_event_get_type(event))
62 { 68 {
63 case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: 69 case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN:
64 _eval_callback(ELPUT_EVENT_SWIPE_BEGIN, dev, libinput_event_get_gesture_event(event)); 70 _eval_callback(ELPUT_EVENT_SWIPE_BEGIN, dev,
71 libinput_event_get_gesture_event(event));
65 break; 72 break;
66 case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: 73 case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE:
67 _eval_callback(ELPUT_EVENT_SWIPE_UPDATE, dev, libinput_event_get_gesture_event(event)); 74 _eval_callback(ELPUT_EVENT_SWIPE_UPDATE, dev,
75 libinput_event_get_gesture_event(event));
68 break; 76 break;
69 case LIBINPUT_EVENT_GESTURE_SWIPE_END: 77 case LIBINPUT_EVENT_GESTURE_SWIPE_END:
70 _eval_callback(ELPUT_EVENT_SWIPE_END, dev, libinput_event_get_gesture_event(event)); 78 _eval_callback(ELPUT_EVENT_SWIPE_END, dev,
79 libinput_event_get_gesture_event(event));
71 break; 80 break;
72 default: 81 default:
73 ret = 0; 82 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
315_process_events(Elput_Manager *em) 315_process_events(Elput_Manager *em)
316{ 316{
317 struct libinput_event *event; 317 struct libinput_event *event;
318 Elput_Input *ei = &em->input; 318 Elput_Input *ei;
319 319
320 ei = &em->input;
320 while ((ei->lib) && (event = libinput_get_event(ei->lib))) 321 while ((ei->lib) && (event = libinput_get_event(ei->lib)))
321 { 322 {
322 _process_event(em, event); 323 _process_event(em, event);
@@ -342,8 +343,9 @@ _cb_input_dispatch(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
342static void 343static void
343_elput_input_init_cancel(void *data, Ecore_Thread *eth EINA_UNUSED) 344_elput_input_init_cancel(void *data, Ecore_Thread *eth EINA_UNUSED)
344{ 345{
345 Elput_Manager *manager = data; 346 Elput_Manager *manager;
346 347
348 manager = data;
347 manager->input.thread = NULL; 349 manager->input.thread = NULL;
348 if (manager->input.current_pending) 350 if (manager->input.current_pending)
349 { 351 {
@@ -358,8 +360,9 @@ _elput_input_init_cancel(void *data, Ecore_Thread *eth EINA_UNUSED)
358static void 360static void
359_elput_input_init_end(void *data, Ecore_Thread *eth EINA_UNUSED) 361_elput_input_init_end(void *data, Ecore_Thread *eth EINA_UNUSED)
360{ 362{
361 Elput_Manager *manager = data; 363 Elput_Manager *manager;
362 364
365 manager = data;
363 manager->input.thread = NULL; 366 manager->input.thread = NULL;
364 if (!manager->input.lib) return; 367 if (!manager->input.lib) return;
365 368
@@ -389,8 +392,9 @@ _elput_input_init_end(void *data, Ecore_Thread *eth EINA_UNUSED)
389static void 392static void
390_elput_input_init_notify(void *data EINA_UNUSED, Ecore_Thread *eth EINA_UNUSED, void *msg_data) 393_elput_input_init_notify(void *data EINA_UNUSED, Ecore_Thread *eth EINA_UNUSED, void *msg_data)
391{ 394{
392 Elput_Async_Open *ao = msg_data; 395 Elput_Async_Open *ao;
393 396
397 ao = msg_data;
394 ao->manager->interface->open_async(ao->manager, ao->path, ao->flags); 398 ao->manager->interface->open_async(ao->manager, ao->path, ao->flags);
395 free(ao->path); 399 free(ao->path);
396 free(ao); 400 free(ao);
@@ -399,9 +403,10 @@ _elput_input_init_notify(void *data EINA_UNUSED, Ecore_Thread *eth EINA_UNUSED,
399static void 403static void
400_elput_input_init_thread(void *data, Ecore_Thread *eth EINA_UNUSED) 404_elput_input_init_thread(void *data, Ecore_Thread *eth EINA_UNUSED)
401{ 405{
402 Elput_Manager *manager = data; 406 Elput_Manager *manager;
403 struct udev *udev; 407 struct udev *udev;
404 408
409 manager = data;
405 udev = udev_new(); 410 udev = udev_new();
406 411
407 manager->input.lib = 412 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;
56# endif 56# endif
57# define CRIT(...) EINA_LOG_DOM_CRIT(_elput_log_dom, __VA_ARGS__) 57# define CRIT(...) EINA_LOG_DOM_CRIT(_elput_log_dom, __VA_ARGS__)
58#endif 58#endif
59
59typedef struct _Elput_Interface 60typedef struct _Elput_Interface
60{ 61{
61 Eina_Bool (*connect)(Elput_Manager **manager, const char *seat, unsigned int tty); 62 Eina_Bool (*connect)(Elput_Manager **manager, const char *seat, unsigned int tty);
@@ -246,11 +247,12 @@ struct _Elput_Device
246 Eina_Bool invert_y : 1; 247 Eina_Bool invert_y : 1;
247}; 248};
248 249
249struct _Elput_Swipe_Gesture { 250struct _Elput_Swipe_Gesture
250 double dx, dy; 251{
251 int finger_count; 252 double dx, dy;
252 int window; 253 int finger_count;
253 Elput_Device *device; 254 int window;
255 Elput_Device *device;
254}; 256};
255 257
256struct _Elput_Manager 258struct _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 @@
12static Eina_Bool 12static Eina_Bool
13_user_part_of_input(void) 13_user_part_of_input(void)
14{ 14{
15 uid_t user = getuid(); 15 uid_t user;
16 struct passwd *user_pw = getpwuid(user); 16 struct passwd *user_pw;
17 gid_t *gids = NULL; 17 gid_t *gids = NULL;
18 int number_of_groups = 0; 18 int number_of_groups = 0;
19 struct group *input_group = getgrnam("input"); 19 struct group *input_group;
20
21 user = getuid();
22 user_pw = getpwuid(user);
23 input_group = getgrnam("input");
20 24
21 EINA_SAFETY_ON_NULL_RETURN_VAL(user_pw, EINA_FALSE); 25 EINA_SAFETY_ON_NULL_RETURN_VAL(user_pw, EINA_FALSE);
22 EINA_SAFETY_ON_NULL_RETURN_VAL(input_group, EINA_FALSE); 26 EINA_SAFETY_ON_NULL_RETURN_VAL(input_group, EINA_FALSE);
@@ -104,9 +108,9 @@ err:
104static void 108static void
105_root_open_async(Elput_Manager *em, const char *path, int flags) 109_root_open_async(Elput_Manager *em, const char *path, int flags)
106{ 110{
107 int fd = _root_open(em, path, flags); 111 int fd, ret;
108 int ret;
109 112
113 fd = _root_open(em, path, flags);
110 while (1) 114 while (1)
111 { 115 {
112 ret = write(em->input.pipe, &fd, sizeof(int)); 116 ret = write(em->input.pipe, &fd, sizeof(int));