From: Jihoon Kim Date: Tue, 4 Jul 2023 08:21:33 +0000 (+0900) Subject: Fix bug not to get device information of touch event X-Git-Tag: accepted/tizen/unified/20230706.152207~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a98e77dbfb0d751bda354efcde52c05048b3e95a;p=platform%2Fupstream%2Fenlightenment.git Fix bug not to get device information of touch event Change-Id: I71e9e374f0dd765bf2f4c37b4bca4ea2621077c8 Signed-off-by: Jihoon Kim --- diff --git a/src/bin/e_input_evdev.c b/src/bin/e_input_evdev.c index 5f6de2f..9aa5593 100644 --- a/src/bin/e_input_evdev.c +++ b/src/bin/e_input_evdev.c @@ -779,6 +779,8 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event if (!(input = edev->seat->input)) return; + 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) { @@ -808,12 +810,12 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event if (!ecore_dev) { ERR("Failed to get source ecore device from event !\n"); - return; + 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. */ - return; + goto end; } if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return; @@ -858,12 +860,11 @@ _device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event ev->multi.root.x = ev->x; ev->multi.root.y = ev->y; - ecore_thread_main_loop_begin(); - ev->dev = ecore_device_ref(ecore_dev); ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _e_input_event_mouse_move_cb_free, NULL); +end: ecore_thread_main_loop_end(); } @@ -1003,6 +1004,8 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin return; } + 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) { @@ -1032,7 +1035,7 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin if (!ecore_dev) { ERR("Failed to get source ecore device from event !\n"); - return; + goto end; } state = libinput_event_pointer_get_button_state(event); @@ -1051,7 +1054,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), edev->seat->dev->blocked_client, edev->seat->dev->server_blocked); - return; + goto end; } else { @@ -1065,14 +1068,14 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin ELOGF("Mouse", "Button Release (btn: %d, device: %s) is blocked by %p, server: 0x%x", NULL, button, ecore_device_name_get(ecore_dev), edev->seat->dev->blocked_client, edev->seat->dev->server_blocked); - return; + goto end; } edev->mouse.pressed_button &= ~(1 << button); } if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) { - return; + goto end; } ev->window = (Ecore_Window)input->dev->window; @@ -1099,9 +1102,6 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin ev->multi.y = ev->y; ev->multi.root.x = ev->x; ev->multi.root.y = ev->y; - - ecore_thread_main_loop_begin(); - ev->dev = ecore_device_ref(ecore_dev); if (state) @@ -1148,6 +1148,7 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin else ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, _e_input_event_mouse_button_cb_free, NULL); +end: ecore_thread_main_loop_end(); } @@ -1216,6 +1217,8 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe return; } + 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) { @@ -1245,7 +1248,7 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe if (!ecore_dev) { ERR("Failed to get source ecore device from event !\n"); - return; + goto end; } axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; @@ -1262,7 +1265,7 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe if (z == 0) { ELOGF("Mouse", "Axis event is ignored since it has zero value", NULL); - return; + goto end; } comp_conf = e_comp_config_get(); @@ -1280,12 +1283,12 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe else ELOGF("Mouse", "Wheel (direction: %d, value: %d) is blocked by %p, server: 0x%x", NULL, direction, z, edev->seat->dev->blocked_client, edev->seat->dev->server_blocked); - return; + goto end; } if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) { - return; + goto end; } timestamp = libinput_event_pointer_get_time(event); @@ -1314,9 +1317,11 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe ELOGF("Mouse", "Wheel (direction: %d, value: %d)", NULL, ev->direction, ev->z); } - ecore_thread_main_loop_begin(); + ev->dev = ecore_device_ref(ecore_dev); ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _e_input_event_mouse_wheel_cb_free, NULL); + +end: ecore_thread_main_loop_end(); } #endif @@ -1393,6 +1398,8 @@ _device_handle_axis_v120(struct libinput_device *device, struct libinput_event_p return; } + 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) { @@ -1422,7 +1429,7 @@ _device_handle_axis_v120(struct libinput_device *device, struct libinput_event_p if (!ecore_dev) { ERR("Failed to get source ecore device from event !\n"); - return; + goto end; } axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; @@ -1439,7 +1446,7 @@ _device_handle_axis_v120(struct libinput_device *device, struct libinput_event_p if (z == 0) { ELOGF("Mouse", "Scroll event is ignored since it has zero value", NULL); - return; + goto end; } comp_conf = e_comp_config_get(); @@ -1457,12 +1464,12 @@ _device_handle_axis_v120(struct libinput_device *device, struct libinput_event_p else ELOGF("Mouse", "Wheel (direction: %d, value: %d) is blocked by %p, server: 0x%x", NULL, direction, z, edev->seat->dev->blocked_client, edev->seat->dev->server_blocked); - return; + goto end; } if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) { - return; + goto end; } timestamp = libinput_event_pointer_get_time(event); @@ -1491,9 +1498,10 @@ _device_handle_axis_v120(struct libinput_device *device, struct libinput_event_p ELOGF("Mouse", "Wheel (direction: %d, value: %d)", NULL, ev->direction, ev->z); } - ecore_thread_main_loop_begin(); ev->dev = ecore_device_ref(ecore_dev); ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _e_input_event_mouse_wheel_cb_free, NULL); + +end: ecore_thread_main_loop_end(); } #endif @@ -1510,6 +1518,8 @@ _device_handle_touch_event_send(E_Input_Evdev *edev, struct libinput_event_touch if (!edev) return; if (!(input = edev->seat->input)) return; + 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) { @@ -1531,10 +1541,10 @@ _device_handle_touch_event_send(E_Input_Evdev *edev, struct libinput_event_touch if (!ecore_dev) { ERR("Failed to get source ecore device from event !\n"); - return; + goto end; } - if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return; + if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) goto end; timestamp = libinput_event_touch_get_time(event); @@ -1576,9 +1586,6 @@ _device_handle_touch_event_send(E_Input_Evdev *edev, struct libinput_event_touch ev->multi.y = ev->y; ev->multi.root.x = ev->x; ev->multi.root.y = ev->y; - - ecore_thread_main_loop_begin(); - ev->dev = ecore_device_ref(ecore_dev); if (state == ECORE_EVENT_MOUSE_BUTTON_DOWN) @@ -1623,6 +1630,7 @@ _device_handle_touch_event_send(E_Input_Evdev *edev, struct libinput_event_touch ecore_event_add(state, ev, _e_input_event_mouse_button_cb_free, NULL); +end: ecore_thread_main_loop_end(); } @@ -1660,10 +1668,10 @@ _device_handle_touch_motion_send(E_Input_Evdev *edev, struct libinput_event_touc if (!ecore_dev) { ERR("Failed to get source ecore device from event !\n"); - return; + goto end; } - if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return; + if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) goto end; ev->window = (Ecore_Window)input->dev->window; ev->event_window = (Ecore_Window)input->dev->window; @@ -1703,6 +1711,7 @@ _device_handle_touch_motion_send(E_Input_Evdev *edev, struct libinput_event_touc ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _e_input_event_mouse_move_cb_free, NULL); +end: ecore_thread_main_loop_end(); } @@ -1718,6 +1727,8 @@ _device_handle_touch_cancel_send(E_Input_Evdev *edev, struct libinput_event_touc if (!edev) return; if (!(input = edev->seat->input)) return; + 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) { @@ -1739,10 +1750,10 @@ _device_handle_touch_cancel_send(E_Input_Evdev *edev, struct libinput_event_touc if (!ecore_dev) { ERR("Failed to get source ecore device from event !\n"); - return; + goto end; } - if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return; + if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) goto end; timestamp = libinput_event_touch_get_time(event); @@ -1771,12 +1782,11 @@ _device_handle_touch_cancel_send(E_Input_Evdev *edev, struct libinput_event_touc edev->touch.pressed &= ~(1 << ev->multi.device); ev->buttons = ((button & 0x00F) + 1); - - ecore_thread_main_loop_begin(); - ev->dev = ecore_device_ref(ecore_dev); ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, ev, _e_input_event_mouse_button_cb_free, NULL); + +end: ecore_thread_main_loop_end(); } @@ -2065,6 +2075,8 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev Eina_List *l; E_Comp_Config *comp_conf; + ecore_thread_main_loop_begin(); + 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; @@ -2096,7 +2108,7 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev goto end; } - if (!(ev = calloc(1, sizeof(Ecore_Event_Axis_Update))))goto end; + if (!(ev = calloc(1, sizeof(Ecore_Event_Axis_Update)))) goto end; ev->window = (Ecore_Window)input->dev->window; ev->event_window = (Ecore_Window)input->dev->window; @@ -2116,15 +2128,12 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev if (comp_conf && comp_conf->input_log_enable) ELOGF("Touch", "Axis (label: %d, value: %lf)", NULL, axis?axis->label:-1, axis?axis->value:0.0); - ecore_thread_main_loop_begin(); - ev->dev = ecore_device_ref(ecore_dev); ecore_event_add(ECORE_EVENT_AXIS_UPDATE, ev, _e_input_aux_data_event_free, NULL); - ecore_thread_main_loop_end(); end: - ; + ecore_thread_main_loop_end(); } E_Input_Evdev *