#define G_LIST_GET_DATA(list) ((list) ? (((GList *)(list))->data) : NULL)
+typedef struct _E_Input_Pending_Event E_Input_Pending_Event;
+
+struct _E_Input_Pending_Event {
+ int type;
+ void *event;
+};
+
static void _device_modifiers_update(E_Input_Evdev *edev);
static void _device_configured_size_get(E_Input_Evdev *edev, int *x, int *y, int *w, int *h);
static void _device_output_assign(E_Input_Evdev *edev, E_Input_Seat_Capabilities cap);
}
#endif
+static Eina_Bool
+_touch_event_pending_add(E_Input_Evdev *edev, int type, void *event)
+{
+ E_Input_Pending_Event *pending_event;
+
+ pending_event = E_NEW(E_Input_Pending_Event, 1);
+ if (!pending_event) return EINA_FALSE;
+
+ pending_event->type = type;
+ pending_event->event = event;
+
+ edev->pending_touch_event = eina_list_append(edev->pending_touch_event, pending_event);
+
+ return EINA_TRUE;
+}
+
+static void
+_touch_event_pending_flush(E_Input_Evdev *edev)
+{
+ E_Input_Pending_Event *ev;
+
+ EINA_LIST_FREE(edev->pending_touch_event, ev)
+ {
+ if ((ev->type == ECORE_EVENT_MOUSE_BUTTON_DOWN) ||
+ (ev->type == ECORE_EVENT_MOUSE_BUTTON_UP))
+ ecore_event_add(ev->type, ev->event, _e_input_event_mouse_button_cb_free, NULL);
+ else if (ev->type == ECORE_EVENT_MOUSE_MOVE)
+ ecore_event_add(ev->type, ev->event, _e_input_event_mouse_move_cb_free, NULL);
+ else if (ev->type == ECORE_EVENT_MOUSE_BUTTON_CANCEL)
+ ecore_event_add(ev->type, ev->event, _e_input_event_mouse_button_cb_free, NULL);
+ else
+ ELOGF("CRI", "NOT Supported pending event. type:%d", NULL, ev->type);
+
+ E_FREE(ev);
+ }
+
+ edev->pending_touch_event = NULL;
+}
+
static void
_device_handle_touch_event_send(E_Input_Evdev *edev, struct libinput_event_touch *event, int state)
{
if (edev->mouse.did_triple)
ev->triple_click = 1;
- ecore_event_add(state, ev, _e_input_event_mouse_button_cb_free, NULL);
+ if (!_touch_event_pending_add(edev, state, ev))
+ {
+ ELOGF("Touch", "Failed to pend event (%s). Call ecore_event_add imediately.", NULL,
+ state == ECORE_EVENT_MOUSE_BUTTON_DOWN ? "DOWN" : "UP");
+ ecore_event_add(state, ev, _e_input_event_mouse_button_cb_free, NULL);
+ }
end:
ecore_thread_main_loop_end();
ev->multi.root.y = ev->y;
ev->dev = ecore_device_ref(ecore_dev);
- ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _e_input_event_mouse_move_cb_free, NULL);
+ if (!_touch_event_pending_add(edev, ECORE_EVENT_MOUSE_MOVE, ev))
+ {
+ ELOGF("Touch", "Failed to pend event (MOVE). Call ecore_event_add imediately.", NULL);
+ ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _e_input_event_mouse_move_cb_free, NULL);
+ }
end:
ecore_thread_main_loop_end();
ev->buttons = ((button & 0x00F) + 1);
ev->dev = ecore_device_ref(ecore_dev);
- ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, ev, _e_input_event_mouse_button_cb_free, NULL);
+ if (!_touch_event_pending_add(edev, ECORE_EVENT_MOUSE_BUTTON_CANCEL, ev))
+ {
+ ELOGF("Touch", "Failed to pend event (CANCEL). Call ecore_event_add imediately.", NULL);
+ ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, ev, _e_input_event_mouse_button_cb_free, NULL);
+ }
end:
ecore_thread_main_loop_end();
static void
-_device_handle_touch_frame(struct libinput_device *device EINA_UNUSED, struct libinput_event_touch *event EINA_UNUSED)
+_device_handle_touch_frame(struct libinput_device *device, struct libinput_event_touch *event)
{
- /* DBG("Unhandled Touch Frame Event"); */
+ E_Input_Evdev *edev;
+
+ if (!(edev = libinput_device_get_user_data(device)))
+ return;
+
+ ecore_thread_main_loop_begin();
+ _touch_event_pending_flush(edev);
+ ecore_thread_main_loop_end();
}
static void
_e_input_evdev_device_destroy(E_Input_Evdev *edev)
{
Ecore_Device *dev;
+ E_Input_Pending_Event *ev;
E_Input *e_input = e_input_get();
EINA_SAFETY_ON_NULL_RETURN(edev);
}
eina_stringshare_del(edev->output_name);
+ if (edev->pending_touch_event)
+ {
+ EINA_LIST_FREE(edev->pending_touch_event, ev)
+ {
+ E_FREE(ev->event);
+ E_FREE(ev);
+ }
+ }
+
ecore_thread_main_loop_end();
free(edev);