e_input_evdev: generate touch aux ecore event asynchronously 68/318468/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 27 Sep 2024 02:12:25 +0000 (11:12 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 30 Sep 2024 07:36:56 +0000 (16:36 +0900)
Change-Id: I45443d7409d20f2114d0130b3bb2522ba8e6c4ef
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/inputmgr/e_input_evdev.c

index e98c99a66ffafb2869482f4d222d104a4400b69c..310dedf5625bed4b2a9fc887fb307454254cca51 100644 (file)
@@ -1831,7 +1831,7 @@ _pointer_touch_ecore_event_add(void *data)
    E_Input_Event_Info *input_info = data;
    Ecore_Device *ecore_dev = NULL;
 
-   if (input_info->touch)
+   if (input_info->touch_event)
      ecore_dev = _main_thread_mode_touch_device_get(input_info->evdev);
    else
      ecore_dev = _main_thread_mode_pointer_device_get(input_info->evdev);
@@ -1846,6 +1846,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)
@@ -2447,11 +2452,10 @@ e_input_edev_handle_touch_aux_data(E_Input_Evdev *evdev, struct libinput_event_t
    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;
    uint32_t timestamp = 0;
    int touch_value;
+   E_Input_Event_Info *input_event = NULL;
 
    EINA_SAFETY_ON_NULL_RETURN(evdev);
 
@@ -2464,33 +2468,7 @@ e_input_edev_handle_touch_aux_data(E_Input_Evdev *evdev, struct libinput_event_t
    timestamp = libinput_event_touch_aux_data_get_time(event);
    touch_value = libinput_event_touch_aux_data_get_value(event);
 
-   ecore_thread_main_loop_begin();
-
-   if (evdev->ecore_dev) ecore_dev = evdev->ecore_dev;
-   else if (evdev->ecore_dev_list && eina_list_count(evdev->ecore_dev_list) > 0)
-     {
-        EINA_LIST_FOREACH(evdev->ecore_dev_list, l, data)
-          {
-             if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_TOUCH)
-               {
-                  ecore_dev = data;
-                  break;
-               }
-          }
-     }
-   else
-     {
-        evdev->ecore_dev = e_input_evdev_ecore_device_get(evdev->path, ECORE_DEVICE_CLASS_TOUCH);
-        ecore_dev = evdev->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;
@@ -2523,12 +2501,15 @@ e_input_edev_handle_touch_aux_data(E_Input_Evdev *evdev, struct libinput_event_t
           }
      }
 
-   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 = evdev;
+   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 *