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;
}
/* 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;
_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
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;
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
#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);
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)
{
};
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;
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;
}
}
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);