Update e_comp_wl with recent wayland changes

- wl_client functions have been deprecated. replaced with wl_resource
 functions

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-07-09 10:27:25 +01:00
parent ce0b069b51
commit 8833073b41
1 changed files with 58 additions and 48 deletions

View File

@ -56,7 +56,7 @@ static void _client_source_accept(struct wl_data_source *source, uint32_t timest
static void _client_source_send(struct wl_data_source *source, const char *mime_type, int32_t fd); static void _client_source_send(struct wl_data_source *source, const char *mime_type, int32_t fd);
static void _client_source_cancel(struct wl_data_source *source); static void _client_source_cancel(struct wl_data_source *source);
static void _e_comp_wl_cb_bind(struct wl_client *client, void *data EINA_UNUSED, unsigned int version EINA_UNUSED, unsigned int id); static void _e_comp_wl_cb_bind(struct wl_client *client, void *data, unsigned int version, unsigned int id);
static Eina_Bool _e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdl EINA_UNUSED); static Eina_Bool _e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdl EINA_UNUSED);
static Eina_Bool _e_comp_wl_cb_idle(void *data EINA_UNUSED); static Eina_Bool _e_comp_wl_cb_idle(void *data EINA_UNUSED);
static Eina_Bool _e_comp_wl_cb_module_idle(void *data EINA_UNUSED); static Eina_Bool _e_comp_wl_cb_module_idle(void *data EINA_UNUSED);
@ -762,10 +762,10 @@ wl_data_source_send_offer(struct wl_data_source *source, struct wl_resource *tar
if (offer == NULL) return NULL; if (offer == NULL) return NULL;
offer->resource = offer->resource =
wl_client_new_object(wl_resource_get_client(target), wl_resource_create(wl_resource_get_client(target),
&wl_data_offer_interface, &_e_data_offer_interface, &wl_data_offer_interface, 1, 0);
offer); wl_resource_set_implementation(offer->resource, &_e_data_offer_interface,
wl_resource_set_destructor(offer->resource, _destroy_data_offer); offer, _destroy_data_offer);
offer->source = source; offer->source = source;
offer->source_destroy_listener.notify = _destroy_offer_data_source; offer->source_destroy_listener.notify = _destroy_offer_data_source;
@ -1097,9 +1097,11 @@ _create_data_source(struct wl_client *client, struct wl_resource *resource, uint
wl_array_init(&source->mime_types); wl_array_init(&source->mime_types);
source->resource = source->resource =
wl_client_add_object(client, &wl_data_source_interface, wl_resource_create(client, &wl_data_source_interface, 1, id);
&_e_data_source_interface, id, source);
wl_resource_set_destructor(source->resource, _destroy_data_source); wl_resource_set_implementation(source->resource,
&_e_data_source_interface, source,
_destroy_data_source);
} }
static void static void
@ -1116,12 +1118,14 @@ _get_data_device(struct wl_client *client, struct wl_resource *manager_resource
seat = wl_resource_get_user_data(seat_resource); seat = wl_resource_get_user_data(seat_resource);
resource = wl_client_add_object(client, &wl_data_device_interface, resource =
&_e_data_device_interface, id, wl_resource_create(client, &wl_data_device_interface, 1, id);
seat);
wl_list_insert(&seat->drag_resource_list, &resource->link); wl_list_insert(&seat->drag_resource_list, &resource->link);
wl_resource_set_destructor(resource, _unbind_data_device);
wl_resource_set_implementation(resource, &_e_data_device_interface, seat,
_unbind_data_device);
} }
static void static void
@ -1135,8 +1139,11 @@ _current_surface_destroy(struct wl_listener *listener, void *data EINA_UNUSED)
static void static void
_bind_manager(struct wl_client *client, void *data EINA_UNUSED, uint32_t version EINA_UNUSED, uint32_t id) _bind_manager(struct wl_client *client, void *data EINA_UNUSED, uint32_t version EINA_UNUSED, uint32_t id)
{ {
wl_client_add_object(client, &wl_data_device_manager_interface, struct wl_resource *res;
&_e_manager_interface, id, NULL);
res = wl_resource_create(client, &wl_data_device_manager_interface, 1, id);
if (res)
wl_resource_set_implementation(res, &_e_manager_interface, NULL, NULL);
} }
static void static void
@ -1428,11 +1435,17 @@ _client_source_cancel(struct wl_data_source *source)
} }
static void static void
_e_comp_wl_cb_bind(struct wl_client *client, void *data EINA_UNUSED, unsigned int version EINA_UNUSED, unsigned int id) _e_comp_wl_cb_bind(struct wl_client *client, void *data, unsigned int version, unsigned int id)
{ {
/* add the compositor object to the client */ E_Wayland_Compositor *comp;
wl_client_add_object(client, &wl_compositor_interface, struct wl_resource *res;
&_e_compositor_interface, id, _e_wl_comp);
if (!(comp = data)) return;
res =
wl_resource_create(client, &wl_compositor_interface, MIN(version, 3), id);
if (res)
wl_resource_set_implementation(res, &_e_compositor_interface, comp, NULL);
} }
static Eina_Bool static Eina_Bool
@ -1600,10 +1613,10 @@ _e_comp_wl_cb_surface_create(struct wl_client *client, struct wl_resource *resou
UINT32_MAX, UINT32_MAX); UINT32_MAX, UINT32_MAX);
ews->wl.surface = ews->wl.surface =
wl_client_add_object(client, &wl_surface_interface, wl_resource_create(client, &wl_surface_interface,
&_e_surface_interface, id, ews); wl_resource_get_version(resource), id);
wl_resource_set_destructor(ews->wl.surface, wl_resource_set_implementation(ews->wl.surface, &_e_surface_interface,
_e_comp_wl_cb_surface_destroy); ews, _e_comp_wl_cb_surface_destroy);
/* add this surface to the list of surfaces */ /* add this surface to the list of surfaces */
_e_wl_comp->surfaces = eina_list_append(_e_wl_comp->surfaces, ews); _e_wl_comp->surfaces = eina_list_append(_e_wl_comp->surfaces, ews);
@ -1681,11 +1694,10 @@ _e_comp_wl_cb_region_create(struct wl_client *client, struct wl_resource *resour
pixman_region32_init(&ewr->region); pixman_region32_init(&ewr->region);
ewr->wl.resource = ewr->wl.resource =
wl_client_add_object(client, &wl_region_interface, wl_resource_create(client, &wl_region_interface,
&_e_region_interface, id, ewr); wl_resource_get_version(resource), id);
wl_resource_set_implementation(ewr->wl.resource, &_e_region_interface, ewr,
wl_resource_set_destructor(ewr->wl.resource, _e_comp_wl_cb_region_destroy);
_e_comp_wl_cb_region_destroy);
} }
static void static void
@ -1838,7 +1850,7 @@ _e_comp_wl_input_shutdown(void)
} }
static void static void
_e_comp_wl_input_cb_bind(struct wl_client *client, void *data, unsigned int version EINA_UNUSED, unsigned int id) _e_comp_wl_input_cb_bind(struct wl_client *client, void *data, unsigned int version, unsigned int id)
{ {
struct wl_seat *seat = NULL; struct wl_seat *seat = NULL;
struct wl_resource *resource = NULL; struct wl_resource *resource = NULL;
@ -1849,12 +1861,12 @@ _e_comp_wl_input_cb_bind(struct wl_client *client, void *data, unsigned int vers
/* add the seat object to the client */ /* add the seat object to the client */
resource = resource =
wl_client_add_object(client, &wl_seat_interface, wl_resource_create(client, &wl_seat_interface, MIN(version, 2), id);
&_e_input_interface, id, data);
wl_list_insert(&seat->base_resource_list, &resource->link); wl_list_insert(&seat->base_resource_list, &resource->link);
/* set resource destroy callback */ wl_resource_set_implementation(resource, &_e_input_interface, data,
wl_resource_set_destructor(resource, _e_comp_wl_input_cb_unbind); _e_comp_wl_input_cb_unbind);
/* set capabilities based on seat */ /* set capabilities based on seat */
if (seat->pointer) caps |= WL_SEAT_CAPABILITY_POINTER; if (seat->pointer) caps |= WL_SEAT_CAPABILITY_POINTER;
@ -2038,12 +2050,11 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re
if (!input->has_pointer) return; if (!input->has_pointer) return;
/* add a pointer object to the client */ /* add a pointer object to the client */
ptr = wl_client_add_object(client, &wl_pointer_interface, ptr = wl_resource_create(client, &wl_pointer_interface,
&_e_pointer_interface, id, input); wl_resource_get_version(resource), id);
wl_list_insert(&input->wl.seat.pointer->resource_list, &ptr->link); wl_list_insert(&input->wl.seat.pointer->resource_list, &ptr->link);
wl_resource_set_implementation(ptr, &_e_pointer_interface,
/* set pointer destroy callback */ input, _e_comp_wl_input_cb_unbind);
wl_resource_set_destructor(ptr, _e_comp_wl_input_cb_unbind);
/* if the pointer has a focused surface, set it */ /* if the pointer has a focused surface, set it */
if ((input->wl.seat.pointer->focus) && if ((input->wl.seat.pointer->focus) &&
@ -2071,11 +2082,11 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r
if (!input->has_keyboard) return; if (!input->has_keyboard) return;
/* add a keyboard object to the client */ /* add a keyboard object to the client */
kbd = wl_client_add_object(client, &wl_keyboard_interface, NULL, id, input); kbd = wl_resource_create(client, &wl_keyboard_interface,
wl_resource_get_version(resource), id);
wl_list_insert(&input->wl.seat.keyboard->resource_list, &kbd->link); wl_list_insert(&input->wl.seat.keyboard->resource_list, &kbd->link);
wl_resource_set_implementation(kbd, NULL, input,
/* set keyboard destroy callback */ _e_comp_wl_input_cb_unbind);
wl_resource_set_destructor(kbd, _e_comp_wl_input_cb_unbind);
/* send the current keymap to the keyboard object */ /* send the current keymap to the keyboard object */
wl_keyboard_send_keymap(kbd, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, wl_keyboard_send_keymap(kbd, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
@ -2110,11 +2121,10 @@ _e_comp_wl_input_cb_touch_get(struct wl_client *client, struct wl_resource *reso
if (!input->has_touch) return; if (!input->has_touch) return;
/* add a touch object to the client */ /* add a touch object to the client */
tch = wl_client_add_object(client, &wl_touch_interface, NULL, id, input); tch = wl_resource_create(client, &wl_touch_interface,
wl_resource_get_version(resource), id);
wl_list_insert(&input->wl.seat.touch->resource_list, &tch->link); wl_list_insert(&input->wl.seat.touch->resource_list, &tch->link);
wl_resource_set_implementation(tch, NULL, input, _e_comp_wl_input_cb_unbind);
/* set touch destroy callback */
wl_resource_set_destructor(tch, _e_comp_wl_input_cb_unbind);
} }
/* pointer functions */ /* pointer functions */
@ -2520,9 +2530,9 @@ _e_comp_wl_surface_cb_frame(struct wl_client *client, struct wl_resource *resour
} }
cb->wl.resource = cb->wl.resource =
wl_client_add_object(client, &wl_callback_interface, NULL, callback, cb); wl_resource_create(client, &wl_callback_interface, 1, callback);
wl_resource_set_destructor(cb->wl.resource, wl_resource_set_implementation(cb->wl.resource, NULL, cb,
_e_comp_wl_surface_cb_frame_destroy); _e_comp_wl_surface_cb_frame_destroy);
/* add this callback to the surface list of pending frames */ /* add this callback to the surface list of pending frames */
wl_list_insert(ews->pending.frames.prev, &cb->wl.link); wl_list_insert(ews->pending.frames.prev, &cb->wl.link);