<arg name="version" type="uint"/>
</event>
+ <!-- Notify the client of removed global objects. -->
+ <event name="global_remove">
+ <arg name="id" type="uint" />
+ </event>
+
<!-- Internal, deprecated, and will be changed. This is an object
IDs range that is used by the client to allocate object IDs
in "new_id" type arguments. The server sends range
}
static void
+display_handle_global_remove(void *data,
+ struct wl_display *display, uint32_t id)
+{
+ struct wl_global *global;
+
+ wl_list_for_each(global, &display->global_list, link)
+ if (global->id == id) {
+ wl_list_remove(&global->link);
+ free(global);
+ break;
+ }
+}
+
+static void
display_handle_range(void *data,
struct wl_display *display, uint32_t range)
{
static const struct wl_display_listener display_listener = {
display_handle_error,
display_handle_global,
+ display_handle_global_remove,
display_handle_range,
display_handle_key
};
struct wl_display *display;
struct wl_list resource_list;
uint32_t id_count;
+ struct wl_list link;
};
struct wl_display {
struct wl_list global_list;
struct wl_list socket_list;
+ struct wl_list client_list;
};
struct wl_frame_listener {
return NULL;
}
+ wl_list_insert(display->client_list.prev, &client->link);
+
wl_list_init(&client->resource_list);
wl_display_post_range(display, client);
wl_event_source_remove(client->source);
wl_connection_destroy(client->connection);
+ wl_list_remove(&client->link);
free(client);
}
wl_list_init(&display->frame_list);
wl_list_init(&display->global_list);
wl_list_init(&display->socket_list);
+ wl_list_init(&display->client_list);
display->client_id_range = 256; /* Gah, arbitrary... */
return 0;
}
+WL_EXPORT int
+wl_display_remove_global(struct wl_display *display,
+ struct wl_object *object)
+{
+ struct wl_global *global;
+ struct wl_client *client;
+
+ wl_list_for_each(global, &display->global_list, link)
+ if (global->object == object)
+ break;
+
+ if (&global->link == &display->global_list)
+ return -1;
+
+ wl_list_for_each(client, &display->client_list, link)
+ wl_client_post_event(client,
+ &client->display->object,
+ WL_DISPLAY_GLOBAL_REMOVE,
+ global->object->id);
+ wl_list_remove(&global->link);
+ free(global);
+
+ return 0;
+}
+
WL_EXPORT void
wl_display_post_frame(struct wl_display *display, struct wl_surface *surface,
uint32_t time)
struct wl_object *object,
wl_global_bind_func_t func);
+int wl_display_remove_global(struct wl_display *display,
+ struct wl_object *object);
+
struct wl_client *wl_client_create(struct wl_display *display, int fd);
void wl_client_destroy(struct wl_client *client);
void wl_client_post_error(struct wl_client *client, struct wl_object *object,