E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREEN_CHANGE, _e_comp_wl_cb_randr_change, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_COMP_OBJECT_ADD, _e_comp_wl_cb_comp_object_add, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, _e_comp_wl_cb_mouse_move, NULL);
- E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_CANCEL, _e_comp_wl_cb_mouse_button_cancel, NULL);
+ E_LIST_HANDLER_PREPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_CANCEL, _e_comp_wl_cb_mouse_button_cancel, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DISPLAY_STATE_CHANGE, _e_comp_wl_cb_zone_display_state_change, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN, _e_comp_wl_cb_client_rot_change_begin, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL, _e_comp_wl_cb_client_rot_change_cancel, NULL);
}
static void
+_device_handle_touch_cancel_send(E_Input_Evdev *edev, struct libinput_event_touch *event)
+{
+ E_Input_Backend *input;
+ Ecore_Event_Mouse_Button *ev;
+ uint32_t timestamp, button = 0;
+ Ecore_Device *ecore_dev = NULL, *data;
+ Eina_List *l;
+
+ if (!edev) return;
+ if (!(input = edev->seat->input)) return;
+
+ 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");
+ return;
+ }
+
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return;
+
+ timestamp = libinput_event_touch_get_time(event);
+
+ ev->window = (Ecore_Window)input->dev->window;
+ ev->event_window = (Ecore_Window)input->dev->window;
+ ev->root_window = (Ecore_Window)input->dev->window;
+ ev->timestamp = timestamp;
+ ev->same_screen = 1;
+
+ ev->x = edev->seat->ptr.ix;
+ ev->y = edev->seat->ptr.iy;
+ ev->root.x = ev->x;
+ ev->root.y = ev->y;
+
+ ev->multi.device = edev->mt_slot;
+ ev->multi.radius = 1;
+ ev->multi.radius_x = 1;
+ ev->multi.radius_y = 1;
+ ev->multi.pressure = 1.0;
+ ev->multi.angle = 0.0;
+ ev->multi.x = ev->x;
+ ev->multi.y = ev->y;
+ ev->multi.root.x = ev->x;
+ ev->multi.root.y = ev->y;
+ ev->dev = ecore_device_ref(ecore_dev);
+
+ edev->touch.pressed &= ~(1 << ev->multi.device);
+
+ ev->buttons = ((button & 0x00F) + 1);
+
+ ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, ev, _e_input_event_mouse_button_cb_free, NULL);
+}
+
+static void
_device_handle_touch_down(struct libinput_device *device, struct libinput_event_touch *event)
{
E_Input_Evdev *edev;
}
static void
+_device_handle_touch_cancel(struct libinput_device *device, struct libinput_event_touch *event)
+{
+ E_Input_Evdev *edev;
+ E_Comp_Config *comp_conf = NULL;
+
+ if (!(edev = libinput_device_get_user_data(device)))
+ {
+ return;
+ }
+
+ edev->mt_slot = libinput_event_touch_get_slot(event);
+ if (edev->mt_slot < 0)
+ {
+ /* FIXME: The single touch device return slot id -1
+ * But currently we have no API to distinguish multi touch or single touch
+ * After libinput 1.11 version, libinput provides get_touch_count API,
+ * so we can distinguish multi touch device or single touch device.
+ */
+ if (edev->mt_slot == -1)
+ edev->mt_slot = 0;
+ else
+ {
+ WRN("%d slot touch up events are not supported\n", edev->mt_slot);
+ return;
+ }
+ }
+
+ comp_conf = e_comp_config_get();
+ if (comp_conf && comp_conf->input_log_enable)
+ ELOGF("Touch", "cancel (id: %d, x: %d, y: %d)", NULL, edev->mt_slot, edev->seat->ptr.ix, edev->seat->ptr.iy);
+
+ _device_handle_touch_cancel_send(edev, event);
+}
+
+
+static void
_device_handle_touch_frame(struct libinput_device *device EINA_UNUSED, struct libinput_event_touch *event EINA_UNUSED)
{
/* DBG("Unhandled Touch Frame Event"); */
case LIBINPUT_EVENT_TOUCH_UP:
_device_handle_touch_up(device, libinput_event_get_touch_event(event));
break;
+ case LIBINPUT_EVENT_TOUCH_CANCEL:
+ _device_handle_touch_cancel(device, libinput_event_get_touch_event(event));
+ break;
case LIBINPUT_EVENT_TOUCH_FRAME:
_device_handle_touch_frame(device, libinput_event_get_touch_event(event));
break;