Add support for server allocated object IDs

We set aside a range of the object ID space for use by the server.  This
allows the server to bind an object to an ID for a client and pass that
object to the client.  The client can use the object immediately and the
server can emit events to the object immdiately.
This commit is contained in:
Kristian Høgsberg 2011-11-18 21:59:36 -05:00
parent 190492b97c
commit bdbd6ef80b
5 changed files with 108 additions and 30 deletions

View file

@ -336,9 +336,15 @@ wl_resource_destroy(struct wl_resource *resource, uint32_t time)
{
struct wl_client *client = resource->client;
wl_resource_queue_event(resource->client->display_resource,
WL_DISPLAY_DELETE_ID, resource->object.id);
wl_map_insert_at(&client->objects, resource->object.id, NULL);
if (resource->object.id < WL_SERVER_ID_START) {
wl_resource_queue_event(resource->client->display_resource,
WL_DISPLAY_DELETE_ID,
resource->object.id);
wl_map_insert_at(&client->objects, resource->object.id, NULL);
} else {
wl_map_remove(&client->objects, resource->object.id);
}
destroy_resource(resource, &time);
}