e_input: Remove libinput mutex 01/304601/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 17 Jan 2024 09:16:05 +0000 (18:16 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 22 Jan 2024 04:39:34 +0000 (13:39 +0900)
Change-Id: I98a0b7f032f6d4add88b876d1060d07339223b55
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_input.c
src/bin/e_input.h
src/bin/e_input_evdev.c
src/bin/e_input_inputs.c

index 93f908f..9f87415 100644 (file)
@@ -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();
index b430f21..f9ae920 100644 (file)
@@ -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
index 054dd37..0ffb1ea 100644 (file)
@@ -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;
index 78037aa..2ef6f60 100644 (file)
@@ -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);