diff --git a/src/bin/e_wayland/e_comp.c b/src/bin/e_wayland/e_comp.c index cf5ff5e0a..21018fe4a 100644 --- a/src/bin/e_wayland/e_comp.c +++ b/src/bin/e_wayland/e_comp.c @@ -10,6 +10,9 @@ static void _e_comp_cb_region_destroy(struct wl_resource *resource); static Eina_Bool _e_comp_cb_read(void *data, Ecore_Fd_Handler *hdl EINA_UNUSED); static Eina_Bool _e_comp_cb_idle(void *data); +static void _e_comp_data_device_cb_get(struct wl_client *client, struct wl_resource *resource, unsigned int id, struct wl_resource *seat_resource); +static void _e_comp_data_device_cb_unbind(struct wl_resource *resource); + /* local interfaces */ static const struct wl_compositor_interface _e_compositor_interface = { @@ -20,7 +23,13 @@ static const struct wl_compositor_interface _e_compositor_interface = static const struct wl_data_device_manager_interface _e_manager_interface = { NULL, // create data source - NULL // get data device + _e_comp_data_device_cb_get +}; + +static const struct wl_data_device_interface _e_data_device_interface = +{ + NULL, // start_drag + NULL, // set_selection }; /* local variables */ @@ -512,3 +521,26 @@ _e_comp_cb_idle(void *data) return ECORE_CALLBACK_RENEW; } + +static void +_e_comp_data_device_cb_get(struct wl_client *client, struct wl_resource *resource, unsigned int id, struct wl_resource *seat_resource) +{ + E_Input *seat; + struct wl_resource *res; + + if (!(seat = seat_resource->data)) return; + + res = wl_client_add_object(client, &wl_data_device_interface, + &_e_data_device_interface, id, seat); + + wl_list_insert(&seat->drag_resources, &res->link); + + res->destroy = _e_comp_data_device_cb_unbind; +} + +static void +_e_comp_data_device_cb_unbind(struct wl_resource *resource) +{ + wl_list_remove(&resource->link); + free(resource); +}