[PATCH 1/3] Update wl_resource.link to wl_slist due to wayland change

alexl at redhat.com alexl at redhat.com
Thu May 23 10:33:43 PDT 2013


From: Alexander Larsson <alexl at redhat.com>

---
 src/compositor.c  | 12 ++++++-----
 src/compositor.h  | 12 +++++------
 src/data-device.c | 10 +++++----
 src/input.c       | 62 +++++++++++++++++++++++++++++++++++++++----------------
 src/shell.c       | 10 +++++----
 5 files changed, 69 insertions(+), 37 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 02e79e6..13a6f47 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -505,11 +505,11 @@ weston_surface_damage_below(struct weston_surface *surface)
 }
 
 static struct wl_resource *
-find_resource_for_client(struct wl_list *list, struct wl_client *client)
+find_resource_for_client(struct wl_slist *list, struct wl_client *client)
 {
         struct wl_resource *r;
 
-        wl_list_for_each(r, list, link) {
+        wl_slist_for_each(r, list, link) {
                 if (r->client == client)
                         return r;
         }
@@ -2494,7 +2494,9 @@ weston_compositor_stack_plane(struct weston_compositor *ec,
 
 static void unbind_resource(struct wl_resource *resource)
 {
-	wl_list_remove(&resource->link);
+	struct weston_output *output = resource->data;
+
+	wl_slist_remove(&output->resource_list, &resource->link);
 	free(resource);
 }
 
@@ -2509,7 +2511,7 @@ bind_output(struct wl_client *client,
 	resource = wl_client_add_object(client,
 					&wl_output_interface, NULL, id, data);
 
-	wl_list_insert(&output->resource_list, &resource->link);
+	wl_slist_insert(&output->resource_list, &resource->link);
 	resource->destroy = unbind_resource;
 
 	wl_output_send_geometry(resource,
@@ -2712,7 +2714,7 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
 	wl_signal_init(&output->frame_signal);
 	wl_signal_init(&output->destroy_signal);
 	wl_list_init(&output->animation_list);
-	wl_list_init(&output->resource_list);
+	wl_slist_init(&output->resource_list);
 
 	output->id = ffs(~output->compositor->output_id_pool) - 1;
 	output->compositor->output_id_pool |= 1 << output->id;
diff --git a/src/compositor.h b/src/compositor.h
index 06476cc..176b501 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -161,7 +161,7 @@ struct weston_output {
 	void *renderer_state;
 
 	struct wl_list link;
-	struct wl_list resource_list;
+	struct wl_slist resource_list;
 	struct wl_global *global;
 	struct weston_compositor *compositor;
 	struct weston_matrix matrix;
@@ -279,7 +279,7 @@ struct wl_data_source {
 struct weston_pointer {
 	struct weston_seat *seat;
 
-	struct wl_list resource_list;
+	struct wl_slist resource_list;
 	struct weston_surface *focus;
 	struct wl_resource *focus_resource;
 	struct wl_listener focus_listener;
@@ -305,7 +305,7 @@ struct weston_pointer {
 struct weston_touch {
 	struct weston_seat *seat;
 
-	struct wl_list resource_list;
+	struct wl_slist resource_list;
 	struct weston_surface *focus;
 	struct wl_resource *focus_resource;
 	struct wl_listener focus_listener;
@@ -388,7 +388,7 @@ struct weston_xkb_info {
 struct weston_keyboard {
 	struct weston_seat *seat;
 
-	struct wl_list resource_list;
+	struct wl_slist resource_list;
 	struct weston_surface *focus;
 	struct wl_resource *focus_resource;
 	struct wl_listener focus_listener;
@@ -415,7 +415,7 @@ struct weston_keyboard {
 };
 
 struct weston_seat {
-	struct wl_list base_resource_list;
+	struct wl_slist base_resource_list;
 
 	struct weston_pointer *pointer;
 	struct weston_keyboard *keyboard;
@@ -428,7 +428,7 @@ struct weston_seat {
 	enum weston_keyboard_modifier modifier_state;
 	struct weston_surface *saved_kbd_focus;
 	struct wl_listener saved_kbd_focus_listener;
-	struct wl_list drag_resource_list;
+	struct wl_slist drag_resource_list;
 
 	uint32_t selection_serial;
 	struct wl_data_source *selection_data_source;
diff --git a/src/data-device.c b/src/data-device.c
index 0decbb9..9dc988f 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -163,11 +163,11 @@ static struct wl_data_source_interface data_source_interface = {
 };
 
 static struct wl_resource *
-find_resource(struct wl_list *list, struct wl_client *client)
+find_resource(struct wl_slist *list, struct wl_client *client)
 {
 	struct wl_resource *r;
 
-	wl_list_for_each(r, list, link) {
+	wl_slist_for_each(r, list, link) {
 		if (r->client == client)
 			return r;
 	}
@@ -563,7 +563,9 @@ create_data_source(struct wl_client *client,
 
 static void unbind_data_device(struct wl_resource *resource)
 {
-	wl_list_remove(&resource->link);
+	struct weston_seat *seat = resource->data;
+
+	wl_slist_remove(&seat->drag_resource_list, &resource->link);
 	free(resource);
 }
 
@@ -579,7 +581,7 @@ get_data_device(struct wl_client *client,
 					&data_device_interface, id,
 					seat);
 
-	wl_list_insert(&seat->drag_resource_list, &resource->link);
+	wl_slist_insert(&seat->drag_resource_list, &resource->link);
 	resource->destroy = unbind_data_device;
 }
 
diff --git a/src/input.c b/src/input.c
index 129593f..4a939c1 100644
--- a/src/input.c
+++ b/src/input.c
@@ -37,9 +37,35 @@ empty_region(pixman_region32_t *region)
 	pixman_region32_init(region);
 }
 
-static void unbind_resource(struct wl_resource *resource)
+static void unbind_keyboard_resource(struct wl_resource *resource)
 {
-	wl_list_remove(&resource->link);
+	struct weston_seat *seat = resource->data;
+
+	wl_slist_remove(&seat->keyboard->resource_list, &resource->link);
+	free(resource);
+}
+
+static void unbind_touch_resource(struct wl_resource *resource)
+{
+	struct weston_seat *seat = resource->data;
+
+	wl_slist_remove(&seat->touch->resource_list, &resource->link);
+	free(resource);
+}
+
+static void unbind_pointer_resource(struct wl_resource *resource)
+{
+	struct weston_pointer *pointer = resource->data;
+
+	wl_slist_remove(&pointer->resource_list, &resource->link);
+	free(resource);
+}
+
+static void unbind_base_resource(struct wl_resource *resource)
+{
+	struct weston_seat *seat = resource->data;
+
+	wl_slist_remove(&seat->base_resource_list, &resource->link);
 	free(resource);
 }
 
@@ -234,14 +260,14 @@ default_grab_key(struct weston_keyboard_grab *grab,
 }
 
 static struct wl_resource *
-find_resource_for_surface(struct wl_list *list, struct weston_surface *surface)
+find_resource_for_surface(struct wl_slist *list, struct weston_surface *surface)
 {
 	struct wl_resource *r;
 
 	if (!surface)
 		return NULL;
 
-	wl_list_for_each(r, list, link) {
+	wl_slist_for_each(r, list, link) {
 		if (r->client == surface->resource.client)
 			return r;
 	}
@@ -317,7 +343,7 @@ weston_pointer_create(void)
 		return NULL;
 
 	memset(pointer, 0, sizeof *pointer);
-	wl_list_init(&pointer->resource_list);
+	wl_slist_init(&pointer->resource_list);
 	pointer->focus_listener.notify = lose_pointer_focus;
 	pointer->default_grab.interface = &default_pointer_grab_interface;
 	pointer->default_grab.pointer = pointer;
@@ -355,7 +381,7 @@ weston_keyboard_create(void)
 	    return NULL;
 
 	memset(keyboard, 0, sizeof *keyboard);
-	wl_list_init(&keyboard->resource_list);
+	wl_slist_init(&keyboard->resource_list);
 	wl_array_init(&keyboard->keys);
 	keyboard->focus_listener.notify = lose_keyboard_focus;
 	keyboard->default_grab.interface = &default_keyboard_grab_interface;
@@ -386,7 +412,7 @@ weston_touch_create(void)
 		return NULL;
 
 	memset(touch, 0, sizeof *touch);
-	wl_list_init(&touch->resource_list);
+	wl_slist_init(&touch->resource_list);
 	touch->focus_listener.notify = lose_touch_focus;
 	touch->default_grab.interface = &default_touch_grab_interface;
 	touch->default_grab.touch = touch;
@@ -418,7 +444,7 @@ seat_send_updated_caps(struct weston_seat *seat)
 	if (seat->touch)
 		caps |= WL_SEAT_CAPABILITY_TOUCH;
 
-	wl_list_for_each(r, &seat->base_resource_list, link)
+	wl_slist_for_each(r, &seat->base_resource_list, link)
 		wl_seat_send_capabilities(r, caps);
 }
 
@@ -1163,8 +1189,8 @@ seat_get_pointer(struct wl_client *client, struct wl_resource *resource,
 
         cr = wl_client_add_object(client, &wl_pointer_interface,
 				  &pointer_interface, id, seat->pointer);
-	wl_list_insert(&seat->pointer->resource_list, &cr->link);
-	cr->destroy = unbind_resource;
+	wl_slist_insert(&seat->pointer->resource_list, &cr->link);
+	cr->destroy = unbind_pointer_resource;
 
 	if (seat->pointer->focus &&
 	    seat->pointer->focus->resource.client == client) {
@@ -1196,8 +1222,8 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
 
         cr = wl_client_add_object(client, &wl_keyboard_interface, NULL, id,
 				  seat);
-	wl_list_insert(&seat->keyboard->resource_list, &cr->link);
-	cr->destroy = unbind_resource;
+	wl_slist_insert(&seat->keyboard->resource_list, &cr->link);
+	cr->destroy = unbind_keyboard_resource;
 
 	wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
 				seat->xkb_info.keymap_fd,
@@ -1222,8 +1248,8 @@ seat_get_touch(struct wl_client *client, struct wl_resource *resource,
 		return;
 
         cr = wl_client_add_object(client, &wl_touch_interface, NULL, id, seat);
-	wl_list_insert(&seat->touch->resource_list, &cr->link);
-	cr->destroy = unbind_resource;
+	wl_slist_insert(&seat->touch->resource_list, &cr->link);
+	cr->destroy = unbind_touch_resource;
 }
 
 static const struct wl_seat_interface seat_interface = {
@@ -1241,8 +1267,8 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
 
 	resource = wl_client_add_object(client, &wl_seat_interface,
 					&seat_interface, id, data);
-	wl_list_insert(&seat->base_resource_list, &resource->link);
-	resource->destroy = unbind_resource;
+	wl_slist_insert(&seat->base_resource_list, &resource->link);
+	resource->destroy = unbind_base_resource;
 
 	if (seat->pointer)
 		caps |= WL_SEAT_CAPABILITY_POINTER;
@@ -1471,9 +1497,9 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec)
 	memset(seat, 0, sizeof *seat);
 
 	seat->selection_data_source = NULL;
-	wl_list_init(&seat->base_resource_list);
+	wl_slist_init(&seat->base_resource_list);
 	wl_signal_init(&seat->selection_signal);
-	wl_list_init(&seat->drag_resource_list);
+	wl_slist_init(&seat->drag_resource_list);
 	wl_signal_init(&seat->destroy_signal);
 
 	wl_display_add_global(ec->wl_display, &wl_seat_interface, seat,
diff --git a/src/shell.c b/src/shell.c
index eb8d802..dc7cd05 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -128,7 +128,7 @@ struct desktop_shell {
 		unsigned int current;
 		unsigned int num;
 
-		struct wl_list client_list;
+		struct wl_slist client_list;
 
 		struct weston_animation animation;
 		struct wl_list anim_sticky_list;
@@ -1005,7 +1005,9 @@ static const struct workspace_manager_interface workspace_manager_implementation
 static void
 unbind_resource(struct wl_resource *resource)
 {
-	wl_list_remove(&resource->link);
+	struct desktop_shell *shell = resource->data;
+
+	wl_slist_remove(&shell->workspaces.client_list, &resource->link);
 	free(resource);
 }
 
@@ -1026,7 +1028,7 @@ bind_workspace_manager(struct wl_client *client,
 	}
 
 	resource->destroy = unbind_resource;
-	wl_list_insert(&shell->workspaces.client_list, &resource->link);
+	wl_slist_insert(&shell->workspaces.client_list, &resource->link);
 
 	workspace_manager_send_state(resource,
 				     shell->workspaces.current,
@@ -4429,7 +4431,7 @@ module_init(struct weston_compositor *ec,
 	weston_layer_init(&shell->input_panel_layer, NULL);
 
 	wl_array_init(&shell->workspaces.array);
-	wl_list_init(&shell->workspaces.client_list);
+	wl_slist_init(&shell->workspaces.client_list);
 
 	shell_configuration(shell, ec->config_fd);
 
-- 
1.8.1.4



More information about the wayland-devel mailing list