data-device: Start a cleanup

This commit is contained in:
Jasper St. Pierre 2014-07-10 10:19:47 -04:00
parent 9b5d6cc008
commit 581335fbea

View File

@ -48,6 +48,12 @@ struct _MetaWaylandDataSource
struct wl_array mime_types; struct wl_array mime_types;
}; };
static void
unbind_resource (struct wl_resource *resource)
{
wl_list_remove (wl_resource_get_link (resource));
}
static void static void
data_offer_accept (struct wl_client *client, data_offer_accept (struct wl_client *client,
struct wl_resource *resource, struct wl_resource *resource,
@ -483,25 +489,18 @@ create_data_source (struct wl_client *client,
wl_array_init (&source->mime_types); wl_array_init (&source->mime_types);
} }
static void
unbind_data_device (struct wl_resource *resource)
{
wl_list_remove (wl_resource_get_link (resource));
}
static void static void
get_data_device (struct wl_client *client, get_data_device (struct wl_client *client,
struct wl_resource *manager_resource, struct wl_resource *manager_resource,
guint32 id, struct wl_resource *seat_resource) guint32 id, struct wl_resource *seat_resource)
{ {
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource); MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
struct wl_resource *resource; struct wl_resource *cr;
resource = wl_resource_create (client, &wl_data_device_interface, cr = wl_resource_create (client, &wl_data_device_interface,
MIN (META_WL_DATA_DEVICE_VERSION, MIN (META_WL_DATA_DEVICE_VERSION, wl_resource_get_version (manager_resource)), id);
wl_resource_get_version (manager_resource)), id); wl_resource_set_implementation (cr, &data_device_interface, seat, unbind_resource);
wl_resource_set_implementation (resource, &data_device_interface, seat, unbind_data_device); wl_list_insert (&seat->data_device_resource_list, wl_resource_get_link (cr));
wl_list_insert (&seat->data_device_resource_list, wl_resource_get_link (resource));
} }
static const struct wl_data_device_manager_interface manager_interface = { static const struct wl_data_device_manager_interface manager_interface = {