diff --git a/src/bin/e_wayland/e_buffer.h b/src/bin/e_wayland/e_buffer.h index c6c045c4e..13f2ed20d 100644 --- a/src/bin/e_wayland/e_buffer.h +++ b/src/bin/e_wayland/e_buffer.h @@ -24,7 +24,7 @@ struct _E_Buffer union { struct wl_shm_buffer *shm_buffer; - struct wl_buffer *legacy_buffer; + void *legacy_buffer; }; Evas_Coord w, h; diff --git a/src/bin/e_wayland/e_comp.c b/src/bin/e_wayland/e_comp.c index 4b3ce411a..8bbd74a90 100644 --- a/src/bin/e_wayland/e_comp.c +++ b/src/bin/e_wayland/e_comp.c @@ -112,8 +112,8 @@ e_compositor_init(E_Compositor *comp, void *display) wl_signal_init(&comp->signals.seat); /* try to add the compositor to the displays global list */ - if (!wl_display_add_global(comp->wl.display, &wl_compositor_interface, - comp, _e_comp_cb_bind)) + if (!wl_global_create(comp->wl.display, &wl_compositor_interface, + 3, comp, _e_comp_cb_bind)) { ERR("Could not add compositor to globals: %m"); goto global_err; @@ -131,9 +131,8 @@ e_compositor_init(E_Compositor *comp, void *display) } /* initialize the data device manager */ - if (!wl_display_add_global(comp->wl.display, - &wl_data_device_manager_interface, NULL, - _e_comp_cb_bind_manager)) + if (!wl_global_create(comp->wl.display, &wl_data_device_manager_interface, + 1, NULL, _e_comp_cb_bind_manager)) { ERR("Could not add data device manager to globals: %m"); goto global_err; @@ -385,20 +384,24 @@ static void _e_comp_cb_bind(struct wl_client *client, void *data, unsigned int version EINA_UNUSED, unsigned int id) { E_Compositor *comp; + struct wl_resource *res; if (!(comp = data)) return; - /* add the compositor to the client */ - wl_client_add_object(client, &wl_compositor_interface, - &_e_compositor_interface, id, comp); + 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 void _e_comp_cb_bind_manager(struct wl_client *client, void *data EINA_UNUSED, unsigned int version EINA_UNUSED, unsigned int id) { - /* add the data device manager to the client */ - wl_client_add_object(client, &wl_data_device_manager_interface, - &_e_manager_interface, id, NULL); + struct wl_resource *res; + + 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 @@ -413,7 +416,7 @@ _e_comp_cb_surface_create(struct wl_client *client, struct wl_resource *resource if (!(comp = resource->data)) return; /* try to create a new surface */ - if (!(es = e_surface_new(client, id))) + if (!(es = e_surface_new(client, resource, id))) { wl_resource_post_no_memory(resource); return; @@ -527,11 +530,11 @@ _e_comp_data_device_cb_get(struct wl_client *client, struct wl_resource *resourc if (!(seat = wl_resource_get_user_data(seat_resource))) return; - res = wl_client_add_object(client, &wl_data_device_interface, - &_e_data_device_interface, id, seat); + res = wl_resource_create(client, &wl_data_device_interface, 1, id); wl_list_insert(&seat->drag_resources, wl_resource_get_link(res)); - wl_resource_set_destructor(res, _e_comp_data_device_cb_unbind); + wl_resource_set_implementation(res, &_e_data_device_interface, + seat, _e_comp_data_device_cb_unbind); } static void diff --git a/src/bin/e_wayland/e_region.c b/src/bin/e_wayland/e_region.c index f93887399..cef7e5117 100644 --- a/src/bin/e_wayland/e_region.c +++ b/src/bin/e_wayland/e_region.c @@ -1,6 +1,7 @@ #include "e.h" /* local function prototypes */ +static void _e_region_destroy(struct wl_resource *resource); static void _e_region_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource); static void _e_region_cb_add(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int x, int y, int w, int h); static void _e_region_cb_subtract(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int x, int y, int w, int h); @@ -24,13 +25,24 @@ e_region_new(struct wl_client *client, unsigned int id) pixman_region32_init(®->region); reg->resource = - wl_client_add_object(client, &wl_region_interface, - &_e_region_interface, id, reg); + wl_resource_create(client, &wl_region_interface, 1, id); + wl_resource_set_implementation(reg->resource, &_e_region_interface, + reg, _e_region_destroy); return reg; } /* local functions */ +static void +_e_region_destroy(struct wl_resource *resource) +{ + E_Region *reg; + + if (!(reg = wl_resource_get_user_data(resource))) return; + pixman_region32_fini(®->region); + E_FREE(reg); +} + static void _e_region_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) { diff --git a/src/bin/e_wayland/e_surface.c b/src/bin/e_wayland/e_surface.c index db93665cb..f158dcbde 100644 --- a/src/bin/e_wayland/e_surface.c +++ b/src/bin/e_wayland/e_surface.c @@ -27,7 +27,7 @@ static const struct wl_surface_interface _e_surface_interface = }; EAPI E_Surface * -e_surface_new(struct wl_client *client, unsigned int id) +e_surface_new(struct wl_client *client, struct wl_resource *resource, unsigned int id) { E_Surface *es; @@ -62,8 +62,10 @@ e_surface_new(struct wl_client *client, unsigned int id) UINT32_MAX, UINT32_MAX); es->wl.resource = - wl_client_add_object(client, &wl_surface_interface, - &_e_surface_interface, id, es); + wl_resource_create(client, &wl_surface_interface, + wl_resource_get_version(resource), id); + wl_resource_set_implementation(es->wl.resource, + &_e_surface_interface, es, NULL); return es; } @@ -460,9 +462,10 @@ _e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsi } cb->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->resource, _e_surface_frame_cb_destroy); + wl_resource_set_implementation(cb->resource, NULL, cb, + _e_surface_frame_cb_destroy); /* append the callback to pending frames */ wl_list_insert(es->pending.frames.prev, &cb->link); diff --git a/src/bin/e_wayland/e_surface.h b/src/bin/e_wayland/e_surface.h index 260c2d598..d0b8ced77 100644 --- a/src/bin/e_wayland/e_surface.h +++ b/src/bin/e_wayland/e_surface.h @@ -77,7 +77,7 @@ struct _E_Surface_Frame struct wl_list link; }; -EAPI E_Surface *e_surface_new(struct wl_client *client, unsigned int id); +EAPI E_Surface *e_surface_new(struct wl_client *client, struct wl_resource *resource, unsigned int id); EAPI void e_surface_attach(E_Surface *es, E_Buffer *buffer); EAPI void e_surface_unmap(E_Surface *es); EAPI void e_surface_damage(E_Surface *es);