e_input: add name variable to Evdev device struct and assign value from libinput 24/318924/2
authorduna.oh <duna.oh@samsung.com>
Wed, 12 Jun 2024 09:40:58 +0000 (18:40 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 28 Oct 2024 03:06:08 +0000 (12:06 +0900)
This patch impedes E20 from invoking libinput APIs subsequently.

Change-Id: If0730eec77feb3fb28e57b92cc1deee6504a43e5

src/bin/e_input_device.c
src/bin/e_input_evdev.c
src/bin/e_input_inputs.c
src/bin/e_input_private.h

index d9080e5717b4f49f56ceea8ff7e762f2952cfe00..2627a25d26887bf3ca0f04716b6ff62d36c62987 100644 (file)
@@ -346,7 +346,7 @@ e_input_device_pointer_warp(E_Input_Device *dev, int x, int y)
                                                  LIBINPUT_DEVICE_CAP_POINTER))
                continue;
 
-             if (!e_util_strcmp(libinput_device_get_name(edev->device), device_name) &&
+             if (!e_util_strcmp(edev->name, device_name) &&
                  !e_util_strcmp(edev->path, device_path))
                {
                   warp_dev = edev;
@@ -360,7 +360,7 @@ e_input_device_pointer_warp(E_Input_Device *dev, int x, int y)
           {
              if (seat->ptr.ix != x || seat->ptr.iy != y)
                {
-                  _e_input_hook_call(E_INPUT_HOOK_POINTER_WARP, libinput_device_get_name(warp_dev->device));
+                  _e_input_hook_call(E_INPUT_HOOK_POINTER_WARP, warp_dev->name);
 
                   seat->ptr.dx = seat->ptr.ix = x;
                   seat->ptr.dy = seat->ptr.iy = y;
@@ -401,7 +401,7 @@ e_input_device_pointer_left_handed_set(E_Input_Device *dev, Eina_Bool left_hande
                       LIBINPUT_CONFIG_STATUS_SUCCESS)
                     {
                        WRN("Failed to set left hand mode about device: %s\n",
-                           libinput_device_get_name(edev->device));
+                           edev->name);
                        continue;
                     }
                }
@@ -1614,7 +1614,7 @@ e_input_device_mouse_accel_enable_set(const char *device_name, Eina_Bool enable)
              EINA_LIST_FOREACH(seat->devices, lll, edev)
                {
                   if ((edev->caps & E_INPUT_SEAT_POINTER) &&
-                      (!e_util_strcmp(device_name, libinput_device_get_name(edev->device))))
+                      (!e_util_strcmp(device_name, edev->name)))
                     {
                        found = EINA_TRUE;
                        edev->disable_acceleration = !enable;
index 8e9056e22bee10b5a8ad6cf9e3ef24f5d1cea3ba..722d55f89a88b9299ede5462ed28f0552e856882 100644 (file)
@@ -844,6 +844,7 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event
    Ecore_Device *ecore_dev = NULL, *data, *detent_data = NULL;
    Eina_List *l;
    int x = 0, y = 0, w = 0, h = 0;
+   const char *device_name = edev->name;
 
    if (!(input = edev->seat->input)) return;
 
@@ -864,7 +865,7 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event
                   detent_data = data;
                }
           }
-        if (!ecore_dev && e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+        if (!ecore_dev && e_devicemgr_detent_is_detent(device_name))
           {
              ecore_dev = detent_data;
           }
@@ -924,7 +925,7 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event
      {
         ev->timestamp = e_util_timestamp_get();
         ELOGF("Mouse", "Move (x: %d, y: %d, timestamp: %u (current time), device: %s)", NULL,
-              ev->x, ev->y, ev->timestamp, ecore_device_name_get(ecore_dev));
+              ev->x, ev->y, ev->timestamp, device_name);
      }
 
    ev->multi.device = edev->mt_slot;
@@ -960,9 +961,12 @@ _device_pointer_relative_motion(E_Input_Evdev *edev, struct libinput_event_point
    Ecore_Device *ecore_dev = NULL, *data, *detent_data = NULL;
    Eina_List *l;
    E_Comp_Config *comp_conf;
+   const char *device_name = NULL;
 
    if (!(input = edev->seat->input)) return;
 
+   device_name = edev->name;
+
    ecore_thread_main_loop_begin();
 
    if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
@@ -980,7 +984,7 @@ _device_pointer_relative_motion(E_Input_Evdev *edev, struct libinput_event_point
                   detent_data = data;
                }
           }
-        if (!ecore_dev && e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+        if (!ecore_dev && e_devicemgr_detent_is_detent(device_name))
           {
              ecore_dev = detent_data;
           }
@@ -1153,6 +1157,7 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin
    Ecore_Device *ecore_dev = NULL, *detent_data = NULL, *data;
    Eina_List *l;
    E_Comp_Config *comp_conf = NULL;
+   const char *device_name = NULL;
 
    if (!(edev = libinput_device_get_user_data(device)))
      {
@@ -1200,6 +1205,7 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin
    state = libinput_event_pointer_get_button_state(event);
    button = libinput_event_pointer_get_button(event);
    timestamp = libinput_event_pointer_get_time(event);
+   device_name = edev->name;
 
    button = ((button & 0x00F) + 1);
    if (button == 3) button = 2;
@@ -1214,7 +1220,7 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin
           {
 
              ELOGF("Mouse", "Button Press (btn: %d, device: %s) is blocked by %p, server: 0x%x", NULL,
-                   button, ecore_device_name_get(ecore_dev), blocked_client,
+                   button, device_name, blocked_client,
                    edev->seat->dev->server_blocked);
              goto end;
           }
@@ -1369,6 +1375,7 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe
    Eina_List *l;
    E_Comp_Config *comp_conf = NULL;
    int direction = 0, z = 0;
+   const char *device_name = NULL;
 
    if (!(edev = libinput_device_get_user_data(device)))
      {
@@ -1379,6 +1386,8 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe
         return;
      }
 
+   device_name = edev->name;
+
    ecore_thread_main_loop_begin();
 
    if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
@@ -2431,6 +2440,7 @@ _e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device)
    edev->seat = seat;
    edev->device = device;
    edev->path = eina_stringshare_printf("%s/%s", e_input_base_dir_get(), libinput_device_get_sysname(device));
+   edev->name = eina_stringshare_add(libinput_device_get_name(device) ?: "No Name");
 
    if (e_input)
      g_rec_mutex_lock(&e_input->libinput_mutex);
@@ -2455,7 +2465,7 @@ _e_input_evdev_device_create(E_Input_Seat *seat, struct libinput_device *device)
                  LIBINPUT_CONFIG_STATUS_SUCCESS)
                {
                   WRN("Failed to set left hand mode about device: %s\n",
-                      libinput_device_get_name(device));
+                      edev->name);
                }
           }
      }
@@ -2539,6 +2549,7 @@ _e_input_evdev_device_destroy(E_Input_Evdev *edev)
              glist = g_list_next(glist);
           }
      }
+   if (edev->name) eina_stringshare_del(edev->name);
    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);
@@ -2694,7 +2705,7 @@ e_input_evdev_name_get(E_Input_Evdev *evdev)
    EINA_SAFETY_ON_NULL_RETURN_VAL(evdev, NULL);
    EINA_SAFETY_ON_NULL_RETURN_VAL(evdev->device, NULL);
 
-   return libinput_device_get_name(evdev->device);
+   return evdev->name;
 }
 
 EINTERN const char *
@@ -2782,7 +2793,7 @@ e_input_evdev_touch_calibration_set(E_Input_Evdev *edev, float matrix[6])
        LIBINPUT_CONFIG_STATUS_SUCCESS)
      {
         WRN("Failed to set input transformation about device: %s\n",
-            libinput_device_get_name(edev->device));
+            edev->name);
         return EINA_FALSE;
      }
 
@@ -2805,7 +2816,7 @@ e_input_evdev_mouse_accel_speed_set(E_Input_Evdev *edev, double speed)
        LIBINPUT_CONFIG_STATUS_SUCCESS)
      {
         WRN("Failed to set mouse accel about device: %s\n",
-            libinput_device_get_name(edev->device));
+            edev->name);
         return EINA_FALSE;
      }
 
index 68e340d0ee71abee391f5d9c572b2049ecdc653a..9ba2cbb77bc559a992a14462526b6b030c2dd22e 100644 (file)
@@ -236,7 +236,7 @@ _e_input_add_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas, Ecore_De
         return EINA_FALSE;
      }
 
-   ecore_device_name_set(dev, libinput_device_get_name(edev->device));
+   ecore_device_name_set(dev, edev->name);
    ecore_device_identifier_set(dev, edev->path);
    ecore_device_class_set(dev, clas);
    ecore_device_subclass_set(dev, subclas);
@@ -291,7 +291,7 @@ _e_input_add_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas, Ecore_De
           }
      }
 
-   e_device_name_set(e_dev, libinput_device_get_name(edev->device));
+   e_device_name_set(e_dev, edev->name);
    e_device_identifier_set(e_dev, edev->path);
    e_device_class_set(e_dev, clas);
    e_device_subclass_set(e_dev, subclas);
@@ -446,7 +446,7 @@ _e_input_device_add(E_Input_Evdev *edev)
 
    if (edev->caps & E_INPUT_SEAT_POINTER)
      {
-        if (!e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+        if (!e_devicemgr_detent_is_detent(edev->name))
           {
              clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_POINTER);
              subclas = _e_input_device_get_ecore_device_subclass(edev, clas);
@@ -476,7 +476,7 @@ _e_input_device_remove(E_Input_Evdev *edev)
 
    if (edev->caps & E_INPUT_SEAT_POINTER)
      {
-        if (!e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+        if (!e_devicemgr_detent_is_detent(edev->name))
           clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_POINTER);
         _e_input_remove_ecore_device(edev, clas);
      }
index aca3b3e8ce6023d415f07c93b7bd63039b5e2d9e..c71cf705d4c582bf44a06aed7e908e03c007db35 100644 (file)
@@ -100,6 +100,7 @@ struct _E_Input_Evdev
    struct libinput_device *device;
 
    const char *path;
+   const char *name;
    Ecore_Device *ecore_dev;
    Eina_List *ecore_dev_list;
    E_Device *e_dev;