From 65c8b64e536e265be3d908367b639384363fac5d Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 17 Jan 2024 18:16:05 +0900 Subject: [PATCH] e_input: Remove libinput mutex Change-Id: I98a0b7f032f6d4add88b876d1060d07339223b55 Signed-off-by: Jihoon Kim --- src/bin/e_input.c | 2 -- src/bin/e_input.h | 2 -- src/bin/e_input_evdev.c | 26 ++------------------------ src/bin/e_input_inputs.c | 16 ---------------- 4 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/bin/e_input.c b/src/bin/e_input.c index 93f908f..9f87415 100644 --- a/src/bin/e_input.c +++ b/src/bin/e_input.c @@ -169,7 +169,6 @@ e_input_init(Ecore_Evas *ee) } // TODO : make this variable configurable e.g. e.cfg - g_rec_mutex_init(&e_input->libinput_mutex); e_input->input_base_dir = eina_stringshare_add("/dev/input"); e_input->use_thread = EINA_FALSE; @@ -305,7 +304,6 @@ e_input_shutdown(void) eina_stringshare_del(e_input->input_base_dir); e_input_device_close(e_input->dev); - g_rec_mutex_clear(&e_input->libinput_mutex); free(e_input); ecore_event_evas_shutdown(); diff --git a/src/bin/e_input.h b/src/bin/e_input.h index b430f21..f9ae920 100644 --- a/src/bin/e_input.h +++ b/src/bin/e_input.h @@ -76,8 +76,6 @@ struct _E_Input e_input_relative_motion_cb relative_motion_handler; e_input_keyboard_grab_key_cb keyboard_grab_key_handler; - - GRecMutex libinput_mutex; }; struct _E_Input_Device diff --git a/src/bin/e_input_evdev.c b/src/bin/e_input_evdev.c index 054dd37..0ffb1ea 100644 --- a/src/bin/e_input_evdev.c +++ b/src/bin/e_input_evdev.c @@ -40,7 +40,7 @@ _device_calibration_set(E_Input_Evdev *edev) edev->mouse.maxw = w; edev->mouse.maxh = h; - if (libinput_device_has_capability(edev->device, LIBINPUT_DEVICE_CAP_POINTER)) + if (edev->caps & E_INPUT_SEAT_POINTER) { edev->seat->ptr.dx = (double)(w / 2); edev->seat->ptr.dy = (double)(h / 2); @@ -1956,7 +1956,7 @@ _device_configured_size_get(E_Input_Evdev *edev, int *x, int *y, int *w, int *h) edev->mouse.miny = output->config.geom.y; edev->mouse.maxw = output->config.geom.w; edev->mouse.maxh = output->config.geom.h; - if (libinput_device_has_capability(edev->device, LIBINPUT_DEVICE_CAP_POINTER)) + if (edev->caps & E_INPUT_SEAT_POINTER) { edev->seat->ptr.dx = (double)(edev->mouse.maxw / 2); edev->seat->ptr.dy = (double)(edev->mouse.maxh / 2); @@ -2296,8 +2296,6 @@ _e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device) EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL); - E_Input *e_input = e_input_get(); - /* try to allocate space for new evdev */ if (!(edev = calloc(1, sizeof(E_Input_Evdev)))) return NULL; @@ -2305,9 +2303,6 @@ _e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device) edev->device = device; edev->path = eina_stringshare_printf("%s/%s", e_input_base_dir_get(), libinput_device_get_sysname(device)); - if (e_input) - g_rec_mutex_lock(&e_input->libinput_mutex); - if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) { edev->caps |= E_INPUT_SEAT_KEYBOARD; @@ -2364,9 +2359,6 @@ _e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device) /* configure device */ _device_configure(edev); - if (e_input) - g_rec_mutex_unlock(&e_input->libinput_mutex); - return edev; } @@ -2374,8 +2366,6 @@ void _e_input_evdev_device_destroy(E_Input_Evdev *edev) { Ecore_Device *dev; - E_Input *e_input = e_input_get(); - EINA_SAFETY_ON_NULL_RETURN(edev); ecore_thread_main_loop_begin(); @@ -2412,9 +2402,7 @@ _e_input_evdev_device_destroy(E_Input_Evdev *edev) } } if (edev->path) eina_stringshare_del(edev->path); - if (e_input) g_rec_mutex_lock(&e_input->libinput_mutex); if (edev->device) libinput_device_unref(edev->device); - if (e_input) g_rec_mutex_unlock(&e_input->libinput_mutex); if (edev->key_remap_hash) eina_hash_free(edev->key_remap_hash); if (edev->touch.coords) { @@ -2700,7 +2688,6 @@ e_input_evdev_seatname_set(E_Input_Evdev *evdev, const char *seatname) { Eina_Bool res = EINA_FALSE; E_Input_Backend *input; - E_Input *e_input = e_input_get(); EINA_SAFETY_ON_NULL_RETURN_VAL(seatname, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(evdev, EINA_FALSE); @@ -2711,22 +2698,13 @@ e_input_evdev_seatname_set(E_Input_Evdev *evdev, const char *seatname) input = evdev->seat->input; if (!input) return EINA_FALSE; - if (e_input) - g_rec_mutex_lock(&e_input->libinput_mutex); - if (libinput_dispatch(input->libinput) != 0) { ERR("Failed to dispatch libinput events: %m"); - if (e_input) - g_rec_mutex_unlock(&e_input->libinput_mutex); - return EINA_FALSE; } - if (e_input) - g_rec_mutex_unlock(&e_input->libinput_mutex); - /* process pending events */ _input_events_process(input); res = EINA_TRUE; diff --git a/src/bin/e_input_inputs.c b/src/bin/e_input_inputs.c index 78037aa..2ef6f60 100644 --- a/src/bin/e_input_inputs.c +++ b/src/bin/e_input_inputs.c @@ -612,19 +612,11 @@ void _input_events_process(E_Input_Backend *input) { struct libinput_event *event; - E_Input *e_input = e_input_get(); - - if (e_input) - g_rec_mutex_lock(&e_input->libinput_mutex); - while ((event = libinput_get_event(input->libinput))) { _input_event_process(event); libinput_event_destroy(event); } - - if (e_input) - g_rec_mutex_unlock(&e_input->libinput_mutex); } static Eina_Bool @@ -726,8 +718,6 @@ input_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) ELOGF("INPUT", "input_dispatch|B|", NULL); } - E_Input *e_input = e_input_get(); - GIOCondition cond; cond = g_source_query_unix_fd(source, src->tag); @@ -740,9 +730,6 @@ input_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) if (!input->libinput) return G_SOURCE_REMOVE; - if (e_input) - g_rec_mutex_lock(&e_input->libinput_mutex); - if (e_config->key_input_ttrace_enable) { TRACE_INPUT_BEGIN(libinput_dispatch); @@ -758,9 +745,6 @@ input_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) ELOGF("INPUT", "libinput_dispatch|E|", NULL); } - if (e_input) - g_rec_mutex_unlock(&e_input->libinput_mutex); - if (e_config->key_input_ttrace_enable) { TRACE_INPUT_BEGIN(_input_events_process); -- 2.7.4