From: Jihoon Kim Date: Fri, 27 Sep 2024 05:40:54 +0000 (+0900) Subject: e_input_evdev: generate relative mouse event asynchronously X-Git-Tag: accepted/tizen/8.0/unified/20241120.163521~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F318928%2F2;p=platform%2Fupstream%2Fenlightenment.git e_input_evdev: generate relative mouse event asynchronously Change-Id: I4e8664b55f80c55220ad1cb544bd299cc8069f81 Signed-off-by: Jihoon Kim --- diff --git a/src/bin/e_input_evdev.c b/src/bin/e_input_evdev.c index ab9e0f31d8..c57132203e 100644 --- a/src/bin/e_input_evdev.c +++ b/src/bin/e_input_evdev.c @@ -984,54 +984,14 @@ _device_pointer_relative_motion(E_Input_Evdev *edev, struct libinput_event_point { E_Input_Backend *input; Ecore_Event_Mouse_Relative_Move *ev; - Ecore_Device *ecore_dev = NULL, *data, *detent_data = NULL; - Eina_List *l; E_Comp_Config *comp_conf; const char *device_name = NULL; + E_Input_Event_Info *input_event = 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; - 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_MOUSE) - { - ecore_dev = data; - break; - } - else if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_NONE) - { - detent_data = data; - } - } - if (!ecore_dev && e_devicemgr_detent_is_detent(device_name)) - { - ecore_dev = detent_data; - } - } - else - { - edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE); - ecore_dev = edev->ecore_dev; - } - - if (!ecore_dev) - { - ERR("Failed to get source ecore device from event !\n"); - goto end; - } - else if ((detent_data == ecore_dev) || e_devicemgr_detent_is_detent(ecore_device_name_get(ecore_dev))) - { - /* Do not process detent device's move events. */ - goto end; - } - if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Relative_Move)))) return; ev->window = (Ecore_Window)input->dev->window; @@ -1045,16 +1005,19 @@ _device_pointer_relative_motion(E_Input_Evdev *edev, struct libinput_event_point ev->dx_unaccel = (int)dx[1]; ev->dy_unaccel = (int)dy[1]; - ev->dev = ecore_device_ref(ecore_dev); - comp_conf = e_comp_config_get(); if (comp_conf && comp_conf->input_log_enable) - ELOGF("Mouse", "Relative Move (time: %d, dx: %d, dy: %d, unaccel(%d, %d) device: %s)", NULL, ev->timestamp, ev->dx, ev->dy, ev->dx_unaccel, ev->dy_unaccel, ecore_device_name_get(ev->dev)); + ELOGF("Mouse", "Relative Move (time: %d, dx: %d, dy: %d, unaccel(%d, %d) device: %s)", NULL, ev->timestamp, ev->dx, ev->dy, ev->dx_unaccel, ev->dy_unaccel, device_name); - ecore_event_add(ECORE_EVENT_MOUSE_RELATIVE_MOVE, ev, _e_input_event_mouse_relative_move_cb_free, NULL); + input_event = E_NEW(E_Input_Event_Info, 1); + input_event->touch_event = EINA_FALSE; + input_event->evdev = edev; + input_event->ev = ev; + input_event->event_type = ECORE_EVENT_MOUSE_RELATIVE_MOVE; + input_event->free_func = _e_input_event_mouse_relative_move_cb_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); } static void @@ -1669,6 +1632,11 @@ _pointer_touch_ecore_event_add(void *data) Ecore_Event_Mouse_Move *ev = input_info->ev; ev->dev = ecore_device_ref(ecore_dev); } + else if (input_info->event_type == ECORE_EVENT_MOUSE_RELATIVE_MOVE) + { + Ecore_Event_Mouse_Relative_Move *ev = input_info->ev; + ev->dev = ecore_device_ref(ecore_dev); + } else if (input_info->event_type == ECORE_EVENT_MOUSE_WHEEL) { Ecore_Event_Mouse_Wheel *ev = input_info->ev;