e_input_evdev: generate touch aux ecore event asynchronously 27/318927/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 27 Sep 2024 02:12:25 +0000 (11:12 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 28 Oct 2024 03:06:08 +0000 (12:06 +0900)
Change-Id: I45443d7409d20f2114d0130b3bb2522ba8e6c4ef
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_input_evdev.c

index 25e2befcf28f8eb075f2ec748fe51953d207293f..ab9e0f31d830e32e8c16c22d471dcb99cd76c32a 100644 (file)
@@ -1674,6 +1674,11 @@ _pointer_touch_ecore_event_add(void *data)
         Ecore_Event_Mouse_Wheel *ev = input_info->ev;
         ev->dev = ecore_device_ref(ecore_dev);
      }
+   else if (input_info->event_type == ECORE_EVENT_AXIS_UPDATE)
+     {
+        Ecore_Event_Axis_Update *ev = input_info->ev;
+        ev->dev = ecore_device_ref(ecore_dev);
+     }
    else if (input_info->event_type == ECORE_EVENT_MOUSE_BUTTON_DOWN ||
             input_info->event_type == ECORE_EVENT_MOUSE_BUTTON_UP ||
             input_info->event_type == ECORE_EVENT_MOUSE_BUTTON_CANCEL)
@@ -2260,47 +2265,20 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev
    E_Input_Backend *input;
    Ecore_Event_Axis_Update *ev;
    Ecore_Axis *axis;
-   Ecore_Device *ecore_dev = NULL, *data;
-   Eina_List *l;
    E_Comp_Config *comp_conf;
    int touch_value;
-
-   ecore_thread_main_loop_begin();
+   E_Input_Event_Info *input_event = NULL;
 
    if (libinput_event_touch_aux_data_get_type(event) != LIBINPUT_TOUCH_AUX_DATA_TYPE_PALM &&
        libinput_event_touch_aux_data_get_value(event) > 0)
-      goto end;
+      return;
 
-   if (!(edev = libinput_device_get_user_data(device))) goto end;
-   if (!(input = edev->seat->input)) goto end;
+   if (!(edev = libinput_device_get_user_data(device))) return;
+   if (!(input = edev->seat->input)) return;
 
    touch_value = libinput_event_touch_aux_data_get_value(event);
 
-   if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
-   else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
-     {
-        EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
-          {
-             if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_TOUCH)
-               {
-                  ecore_dev = data;
-                  break;
-               }
-          }
-     }
-   else
-     {
-        edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
-        ecore_dev = edev->ecore_dev;
-     }
-
-   if (!ecore_dev)
-     {
-        ERR("Failed to get source ecore device from event !\n");
-        goto end;
-     }
-
-   if (!(ev = calloc(1, sizeof(Ecore_Event_Axis_Update)))) goto end;
+   if (!(ev = calloc(1, sizeof(Ecore_Event_Axis_Update)))) return;
 
    ev->window = (Ecore_Window)input->dev->window;
    ev->event_window = (Ecore_Window)input->dev->window;
@@ -2333,12 +2311,15 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev
           }
      }
 
-   ev->dev = ecore_device_ref(ecore_dev);
-
-   ecore_event_add(ECORE_EVENT_AXIS_UPDATE, ev, _e_input_aux_data_event_free, NULL);
+   input_event = E_NEW(E_Input_Event_Info, 1);
+   input_event->touch_event = EINA_TRUE;
+   input_event->evdev = edev;
+   input_event->ev = ev;
+   input_event->event_type = ECORE_EVENT_AXIS_UPDATE;
+   input_event->free_func = _e_input_aux_data_event_free;
+   input_event->free_func_data = NULL;
 
-end:
-   ecore_thread_main_loop_end();
+   ecore_main_loop_thread_safe_call_async(_pointer_touch_ecore_event_add, input_event);
 }
 
 E_Input_Evdev *