server: Make wl_object and wl_resource opaque structs

With the work to add wl_resource accessors and port weston to use them,
we're ready to make wl_resource and wl_object opaque structs.  We keep
wl_buffer in the header for EGL stacks to use, but don't expose it by
default.  In time we'll remove it completely, but for now it provides a
transition paths for code that still uses wl_buffer.

Reviewed-by: Jason Ekstrand<jason@jlekstrand.net>
This commit is contained in:
Kristian Høgsberg 2013-06-27 20:09:18 -05:00
parent 2e07587443
commit d94a8722cb
11 changed files with 57 additions and 42 deletions

View file

@ -102,6 +102,15 @@ struct wl_global {
struct wl_list link;
};
struct wl_resource {
struct wl_object object;
wl_resource_destroy_func_t destroy;
struct wl_list link;
struct wl_signal destroy_signal;
struct wl_client *client;
void *data;
};
static int wl_debug = 0;
static void
@ -373,6 +382,10 @@ wl_client_get_credentials(struct wl_client *client,
*gid = client->ucred.gid;
}
uint32_t
wl_client_add_resource(struct wl_client *client,
struct wl_resource *resource) WL_DEPRECATED;
WL_EXPORT uint32_t
wl_client_add_resource(struct wl_client *client,
struct wl_resource *resource)
@ -996,9 +1009,15 @@ wl_client_add_object(struct wl_client *client,
return NULL;
}
wl_resource_init(resource, interface, implementation, id, data);
resource->client = client;
resource->object.id = id;
resource->object.interface = interface;
resource->object.implementation = implementation;
wl_signal_init(&resource->destroy_signal);
resource->destroy = NULL;
resource->client = client;
resource->data = data;
if (wl_map_insert_at(&client->objects, 0, resource->object.id, resource) < 0) {
wl_resource_post_error(client->display_resource,