[PATCH weston 1/2] compositor: keep track of the weston_layer a weston_view is in

Giulio Camuffo giuliocamuffo at gmail.com
Tue Dec 10 09:38:06 PST 2013


This introduces a new struct, weston_layer_entry, which is now used
in place of wl_list to keep the link for the layer list in weston_view
and the head of the list in weston_layer.
weston_layer_entry also has a weston_layer*, which points to the layer
the view is in or, in the case the entry it's the head of the list, to
the layer itself.
---
 desktop-shell/exposay.c     |   4 +-
 desktop-shell/input-panel.c |  11 ++--
 desktop-shell/shell.c       | 119 +++++++++++++++++++++++---------------------
 src/compositor.c            |  33 +++++++++---
 src/compositor.h            |  14 +++++-
 src/data-device.c           |   6 +--
 src/input.c                 |   4 +-
 tests/weston-test.c         |   6 +--
 8 files changed, 116 insertions(+), 81 deletions(-)

diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index 81da00a..0d8eeb3 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -195,7 +195,7 @@ exposay_layout(struct desktop_shell *shell)
 	wl_list_init(&shell->exposay.surface_list);
 
 	shell->exposay.num_surfaces = 0;
-	wl_list_for_each(view, &workspace->layer.view_list, layer_link) {
+	wl_list_for_each(view, &workspace->layer.view_list.link, layer_link.link) {
 		if (!get_shell_surface(view->surface))
 			continue;
 		shell->exposay.num_surfaces++;
@@ -246,7 +246,7 @@ exposay_layout(struct desktop_shell *shell)
 		shell->exposay.surface_size = output->height / 2;
 
 	i = 0;
-	wl_list_for_each(view, &workspace->layer.view_list, layer_link) {
+	wl_list_for_each(view, &workspace->layer.view_list.link, layer_link.link) {
 		int pad;
 
 		pad = shell->exposay.surface_size + shell->exposay.padding_inner;
diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
index d97d073..b848640 100644
--- a/desktop-shell/input-panel.c
+++ b/desktop-shell/input-panel.c
@@ -70,8 +70,8 @@ show_input_panels(struct wl_listener *listener, void *data)
 			      &shell->input_panel.surfaces, link) {
 		if (!ipsurf->surface->buffer_ref.buffer)
 			continue;
-		wl_list_insert(&shell->input_panel_layer.view_list,
-			       &ipsurf->view->layer_link);
+		weston_layer_entry_insert(&shell->input_panel_layer.view_list,
+					  &ipsurf->view->layer_link);
 		weston_view_geometry_dirty(ipsurf->view);
 		weston_view_update_transform(ipsurf->view);
 		weston_surface_damage(ipsurf->surface);
@@ -97,7 +97,8 @@ hide_input_panels(struct wl_listener *listener, void *data)
 		wl_list_remove(&shell->input_panel_layer.link);
 
 	wl_list_for_each_safe(view, next,
-			      &shell->input_panel_layer.view_list, layer_link)
+			      &shell->input_panel_layer.view_list.link,
+			      layer_link.link)
 		weston_view_unmap(view);
 }
 
@@ -142,8 +143,8 @@ input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 	weston_view_set_position(ip_surface->view, x, y);
 
 	if (show_surface) {
-		wl_list_insert(&shell->input_panel_layer.view_list,
-			       &ip_surface->view->layer_link);
+		weston_layer_entry_insert(&shell->input_panel_layer.view_list,
+					  &ip_surface->view->layer_link);
 		weston_view_update_transform(ip_surface->view);
 		weston_surface_damage(surface);
 		weston_slide_run(ip_surface->view, ip_surface->view->surface->height, 0, NULL, NULL);
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 9fbac00..6910cd0 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -258,12 +258,12 @@ shell_surface_is_top_fullscreen(struct shell_surface *shsurf)
 
 	shell = shell_surface_get_shell(shsurf);
 
-	if (wl_list_empty(&shell->fullscreen_layer.view_list))
+	if (wl_list_empty(&shell->fullscreen_layer.view_list.link))
 		return false;
 
-	top_fs_ev = container_of(shell->fullscreen_layer.view_list.next,
+	top_fs_ev = container_of(shell->fullscreen_layer.view_list.link.next,
 			         struct weston_view,
-				 layer_link);
+				 layer_link.link);
 	return (shsurf == get_shell_surface(top_fs_ev->surface));
 }
 
@@ -570,7 +570,8 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data)
 	main_surface = weston_surface_get_main_surface(state->keyboard_focus);
 
 	next = NULL;
-	wl_list_for_each(view, &state->ws->layer.view_list, layer_link) {
+	wl_list_for_each(view,
+			 &state->ws->layer.view_list.link, layer_link.link) {
 		if (view->surface == main_surface)
 			continue;
 		if (is_focus_view(view))
@@ -702,8 +703,8 @@ animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
 		ws->fsurf_back->view->alpha = 0.0;
 		focus_surface_created = true;
 	} else {
-		wl_list_remove(&ws->fsurf_front->view->layer_link);
-		wl_list_remove(&ws->fsurf_back->view->layer_link);
+		weston_layer_entry_remove(&ws->fsurf_front->view->layer_link);
+		weston_layer_entry_remove(&ws->fsurf_back->view->layer_link);
 	}
 
 	if (ws->focus_animation) {
@@ -712,11 +713,11 @@ animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
 	}
 
 	if (to)
-		wl_list_insert(&to->layer_link,
-			       &ws->fsurf_front->view->layer_link);
+		weston_layer_entry_insert(&to->layer_link,
+					  &ws->fsurf_front->view->layer_link);
 	else if (from)
-		wl_list_insert(&ws->layer.view_list,
-			       &ws->fsurf_front->view->layer_link);
+		weston_layer_entry_insert(&ws->layer.view_list,
+					  &ws->fsurf_front->view->layer_link);
 
 	if (focus_surface_created) {
 		ws->focus_animation = weston_fade_run(
@@ -724,15 +725,15 @@ animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
 			ws->fsurf_front->view->alpha, 0.6, 300,
 			focus_animation_done, ws);
 	} else if (from) {
-		wl_list_insert(&from->layer_link,
-			       &ws->fsurf_back->view->layer_link);
+		weston_layer_entry_insert(&from->layer_link,
+					  &ws->fsurf_back->view->layer_link);
 		ws->focus_animation = weston_stable_fade_run(
 			ws->fsurf_front->view, 0.0,
 			ws->fsurf_back->view, 0.6,
 			focus_animation_done, ws);
 	} else if (to) {
-		wl_list_insert(&ws->layer.view_list,
-			       &ws->fsurf_back->view->layer_link);
+		weston_layer_entry_insert(&ws->layer.view_list,
+					  &ws->fsurf_back->view->layer_link);
 		ws->focus_animation = weston_stable_fade_run(
 			ws->fsurf_front->view, 0.0,
 			ws->fsurf_back->view, 0.6,
@@ -792,7 +793,7 @@ workspace_create(void)
 static int
 workspace_is_empty(struct workspace *ws)
 {
-	return wl_list_empty(&ws->layer.view_list);
+	return wl_list_empty(&ws->layer.view_list.link);
 }
 
 static struct workspace *
@@ -857,7 +858,7 @@ workspace_translate_out(struct workspace *ws, double fraction)
 	unsigned int height;
 	double d;
 
-	wl_list_for_each(view, &ws->layer.view_list, layer_link) {
+	wl_list_for_each(view, &ws->layer.view_list.link, layer_link.link) {
 		height = get_output_height(view->surface->output);
 		d = height * fraction;
 
@@ -872,7 +873,7 @@ workspace_translate_in(struct workspace *ws, double fraction)
 	unsigned int height;
 	double d;
 
-	wl_list_for_each(view, &ws->layer.view_list, layer_link) {
+	wl_list_for_each(view, &ws->layer.view_list.link, layer_link.link) {
 		height = get_output_height(view->surface->output);
 
 		if (fraction > 0)
@@ -917,7 +918,7 @@ workspace_deactivate_transforms(struct workspace *ws)
 	struct weston_view *view;
 	struct weston_transform *transform;
 
-	wl_list_for_each(view, &ws->layer.view_list, layer_link) {
+	wl_list_for_each(view, &ws->layer.view_list.link, layer_link.link) {
 		if (is_focus_view(view)) {
 			struct focus_surface *fsurf = get_focus_surface(view->surface);
 			transform = &fsurf->workspace_transform;
@@ -1057,7 +1058,7 @@ change_workspace(struct desktop_shell *shell, unsigned int index)
 		return;
 
 	/* Don't change workspace when there is any fullscreen surfaces. */
-	if (!wl_list_empty(&shell->fullscreen_layer.view_list))
+	if (!wl_list_empty(&shell->fullscreen_layer.view_list.link))
 		return;
 
 	from = get_current_workspace(shell);
@@ -1101,7 +1102,7 @@ change_workspace(struct desktop_shell *shell, unsigned int index)
 static bool
 workspace_has_only(struct workspace *ws, struct weston_surface *surface)
 {
-	struct wl_list *list = &ws->layer.view_list;
+	struct wl_list *list = &ws->layer.view_list.link;
 	struct wl_list *e;
 
 	if (wl_list_empty(list))
@@ -1112,7 +1113,7 @@ workspace_has_only(struct workspace *ws, struct weston_surface *surface)
 	if (e->next != list)
 		return false;
 
-	return container_of(e, struct weston_view, layer_link)->surface == surface;
+	return container_of(e, struct weston_view, layer_link.link)->surface == surface;
 }
 
 static void
@@ -1141,8 +1142,8 @@ move_surface_to_workspace(struct desktop_shell *shell,
 	from = get_current_workspace(shell);
 	to = get_workspace(shell, workspace);
 
-	wl_list_remove(&view->layer_link);
-	wl_list_insert(&to->layer.view_list, &view->layer_link);
+	weston_layer_entry_remove(&view->layer_link);
+	weston_layer_entry_insert(&to->layer.view_list, &view->layer_link);
 
 	shell_surface_update_child_surface_layers(shsurf);
 
@@ -1181,8 +1182,8 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell,
 	from = get_current_workspace(shell);
 	to = get_workspace(shell, index);
 
-	wl_list_remove(&view->layer_link);
-	wl_list_insert(&to->layer.view_list, &view->layer_link);
+	weston_layer_entry_remove(&view->layer_link);
+	weston_layer_entry_insert(&to->layer.view_list, &view->layer_link);
 
 	shsurf = get_shell_surface(surface);
 	if (shsurf != NULL)
@@ -1955,7 +1956,7 @@ get_output_panel_height(struct desktop_shell *shell,
 	if (!output)
 		return 0;
 
-	wl_list_for_each(view, &shell->panel_layer.view_list, layer_link) {
+	wl_list_for_each(view, &shell->panel_layer.view_list.link, layer_link.link) {
 		if (view->surface->output == output) {
 			panel_height = view->surface->height;
 			break;
@@ -1968,7 +1969,7 @@ get_output_panel_height(struct desktop_shell *shell,
 /* The surface will be inserted into the list immediately after the link
  * returned by this function (i.e. will be stacked immediately above the
  * returned link). */
-static struct wl_list *
+static struct weston_layer_entry *
 shell_surface_calculate_layer_link (struct shell_surface *shsurf)
 {
 	struct workspace *ws;
@@ -2013,7 +2014,8 @@ shell_surface_calculate_layer_link (struct shell_surface *shsurf)
 			/* TODO: Handle a parent with multiple views */
 			parent = get_default_view(shsurf->parent);
 			if (parent)
-				return parent->layer_link.prev;
+				return container_of(parent->layer_link.link.prev,
+						    struct weston_layer_entry, link);
 		}
 		break;
 	}
@@ -2038,15 +2040,18 @@ static void
 shell_surface_update_child_surface_layers (struct shell_surface *shsurf)
 {
 	struct shell_surface *child;
+	struct weston_layer_entry *prev;
 
 	/* Move the child layers to the same workspace as shsurf. They will be
 	 * stacked above shsurf. */
 	wl_list_for_each_reverse(child, &shsurf->children_list, children_link) {
-		if (shsurf->view->layer_link.prev != &child->view->layer_link) {
+		if (shsurf->view->layer_link.link.prev != &child->view->layer_link.link) {
 			weston_view_geometry_dirty(child->view);
-			wl_list_remove(&child->view->layer_link);
-			wl_list_insert(shsurf->view->layer_link.prev,
-			               &child->view->layer_link);
+			prev = container_of(shsurf->view->layer_link.link.prev,
+					    struct weston_layer_entry, link);
+			weston_layer_entry_remove(&child->view->layer_link);
+			weston_layer_entry_insert(prev,
+						  &child->view->layer_link);
 			weston_view_geometry_dirty(child->view);
 			weston_surface_damage(child->surface);
 
@@ -2067,7 +2072,7 @@ shell_surface_update_child_surface_layers (struct shell_surface *shsurf)
 static void
 shell_surface_update_layer(struct shell_surface *shsurf)
 {
-	struct wl_list *new_layer_link;
+	struct weston_layer_entry *new_layer_link;
 
 	new_layer_link = shell_surface_calculate_layer_link(shsurf);
 
@@ -2075,8 +2080,8 @@ shell_surface_update_layer(struct shell_surface *shsurf)
 		return;
 
 	weston_view_geometry_dirty(shsurf->view);
-	wl_list_remove(&shsurf->view->layer_link);
-	wl_list_insert(new_layer_link, &shsurf->view->layer_link);
+	weston_layer_entry_remove(&shsurf->view->layer_link);
+	weston_layer_entry_insert(new_layer_link, &shsurf->view->layer_link);
 	weston_view_geometry_dirty(shsurf->view);
 	weston_surface_damage(shsurf->surface);
 
@@ -2483,9 +2488,9 @@ shell_ensure_fullscreen_black_view(struct shell_surface *shsurf)
 			                     output->height);
 
 	weston_view_geometry_dirty(shsurf->fullscreen.black_view);
-	wl_list_remove(&shsurf->fullscreen.black_view->layer_link);
-	wl_list_insert(&shsurf->view->layer_link,
-	               &shsurf->fullscreen.black_view->layer_link);
+	weston_layer_entry_remove(&shsurf->fullscreen.black_view->layer_link);
+	weston_layer_entry_insert(&shsurf->view->layer_link,
+				  &shsurf->fullscreen.black_view->layer_link);
 	weston_view_geometry_dirty(shsurf->fullscreen.black_view);
 	weston_surface_damage(shsurf->surface);
 }
@@ -3511,7 +3516,7 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer)
 {
 	struct weston_view *v, *next;
 
-	wl_list_for_each_safe(v, next, &layer->view_list, layer_link) {
+	wl_list_for_each_safe(v, next, &layer->view_list.link, layer_link.link) {
 		if (v->output == ev->output && v != ev) {
 			weston_view_unmap(v);
 			v->surface->configure = NULL;
@@ -3520,8 +3525,8 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer)
 
 	weston_view_set_position(ev, ev->output->x, ev->output->y);
 
-	if (wl_list_empty(&ev->layer_link)) {
-		wl_list_insert(&layer->view_list, &ev->layer_link);
+	if (wl_list_empty(&ev->layer_link.link)) {
+		weston_layer_entry_insert(&layer->view_list, &ev->layer_link);
 		weston_compositor_schedule_repaint(ev->surface->compositor);
 	}
 }
@@ -3626,8 +3631,8 @@ lock_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 	center_on_output(view, get_default_output(shell->compositor));
 
 	if (!weston_surface_is_mapped(surface)) {
-		wl_list_insert(&shell->lock_layer.view_list,
-			       &view->layer_link);
+		weston_layer_entry_insert(&shell->lock_layer.view_list,
+					  &view->layer_link);
 		weston_view_update_transform(view);
 		shell_fade(shell, FADE_IN);
 	}
@@ -4179,8 +4184,8 @@ alt_tab_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
 		preview->view = v = weston_view_create(view->surface);
 		v->output = view->output;
 
-		wl_list_remove(&v->layer_link);
-		wl_list_insert(&ws->layer.view_list, &v->layer_link);
+		weston_layer_entry_remove(&v->layer_link);
+		weston_layer_entry_insert(&ws->layer.view_list, &v->layer_link);
 		weston_view_damage_below(v);
 		weston_surface_damage(v->surface);
 
@@ -4386,10 +4391,10 @@ lower_fullscreen_layer(struct desktop_shell *shell)
 
 	ws = get_current_workspace(shell);
 	wl_list_for_each_reverse_safe(view, prev,
-				      &shell->fullscreen_layer.view_list,
-				      layer_link) {
-		wl_list_remove(&view->layer_link);
-		wl_list_insert(&ws->layer.view_list, &view->layer_link);
+				      &shell->fullscreen_layer.view_list.link,
+				      layer_link.link) {
+		weston_layer_entry_remove(&view->layer_link);
+		weston_layer_entry_insert(&ws->layer.view_list, &view->layer_link);
 		weston_view_damage_below(view);
 		weston_surface_damage(view->surface);
 	}
@@ -4583,8 +4588,8 @@ shell_fade_create_surface(struct desktop_shell *shell)
 	surface->height = 8192;
 	weston_view_set_position(view, 0, 0);
 	weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
-	wl_list_insert(&compositor->fade_layer.view_list,
-		       &view->layer_link);
+	weston_layer_entry_insert(&compositor->fade_layer.view_list,
+				  &view->layer_link);
 	pixman_region32_init(&surface->input);
 
 	return view;
@@ -5068,6 +5073,7 @@ screensaver_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 {
 	struct desktop_shell *shell = surface->configure_private;
 	struct weston_view *view;
+	struct weston_layer_entry *prev;
 
 	if (surface->width == 0)
 		return;
@@ -5079,9 +5085,10 @@ screensaver_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 	view = container_of(surface->views.next, struct weston_view, surface_link);
 	center_on_output(view, surface->output);
 
-	if (wl_list_empty(&view->layer_link)) {
-		wl_list_insert(shell->lock_layer.view_list.prev,
-			       &view->layer_link);
+	if (wl_list_empty(&view->layer_link.link)) {
+		prev = container_of(shell->lock_layer.view_list.link.prev,
+				    struct weston_layer_entry, link);
+		weston_layer_entry_insert(prev, &view->layer_link);
 		weston_view_update_transform(view);
 		wl_event_source_timer_update(shell->screensaver.timer,
 					     shell->screensaver.duration);
@@ -5160,7 +5167,7 @@ switcher_next(struct switcher *switcher)
 	struct shell_surface *shsurf;
 	struct workspace *ws = get_current_workspace(switcher->shell);
 
-	wl_list_for_each(view, &ws->layer.view_list, layer_link) {
+	wl_list_for_each(view, &ws->layer.view_list.link, layer_link.link) {
 		shsurf = get_shell_surface(view->surface);
 		if (shsurf &&
 		    shsurf->type == SHELL_SURFACE_TOPLEVEL &&
@@ -5216,7 +5223,7 @@ switcher_destroy(struct switcher *switcher)
 	struct weston_keyboard *keyboard = switcher->grab.keyboard;
 	struct workspace *ws = get_current_workspace(switcher->shell);
 
-	wl_list_for_each(view, &ws->layer.view_list, layer_link) {
+	wl_list_for_each(view, &ws->layer.view_list.link, layer_link.link) {
 		if (is_focus_view(view))
 			continue;
 
diff --git a/src/compositor.c b/src/compositor.c
index 8f4bdef..705326a 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -361,9 +361,10 @@ weston_view_create(struct weston_surface *surface)
 
 	wl_signal_init(&view->destroy_signal);
 	wl_list_init(&view->link);
-	wl_list_init(&view->layer_link);
+	wl_list_init(&view->layer_link.link);
 
 	view->plane = NULL;
+	view->layer_link.layer = NULL;
 
 	pixman_region32_init(&view->clip);
 
@@ -1229,8 +1230,7 @@ weston_view_unmap(struct weston_view *view)
 	weston_view_damage_below(view);
 	view->output = NULL;
 	view->plane = NULL;
-	wl_list_remove(&view->layer_link);
-	wl_list_init(&view->layer_link);
+	weston_layer_entry_remove(&view->layer_link);
 	wl_list_remove(&view->link);
 	wl_list_init(&view->link);
 	view->output_mask = 0;
@@ -1280,7 +1280,7 @@ weston_view_destroy(struct weston_view *view)
 	}
 
 	wl_list_remove(&view->link);
-	wl_list_remove(&view->layer_link);
+	weston_layer_entry_remove(&view->layer_link);
 
 	pixman_region32_fini(&view->clip);
 	pixman_region32_fini(&view->transform.boundingbox);
@@ -1646,18 +1646,18 @@ weston_compositor_build_view_list(struct weston_compositor *compositor)
 	struct weston_layer *layer;
 
 	wl_list_for_each(layer, &compositor->layer_list, link)
-		wl_list_for_each(view, &layer->view_list, layer_link)
+		wl_list_for_each(view, &layer->view_list.link, layer_link.link)
 			surface_stash_subsurface_views(view->surface);
 
 	wl_list_init(&compositor->view_list);
 	wl_list_for_each(layer, &compositor->layer_list, link) {
-		wl_list_for_each(view, &layer->view_list, layer_link) {
+		wl_list_for_each(view, &layer->view_list.link, layer_link.link) {
 			view_list_add(compositor, view);
 		}
 	}
 
 	wl_list_for_each(layer, &compositor->layer_list, link)
-		wl_list_for_each(view, &layer->view_list, layer_link)
+		wl_list_for_each(view, &layer->view_list.link, layer_link.link)
 			surface_free_unused_subsurface_views(view->surface);
 }
 
@@ -1773,9 +1773,26 @@ idle_repaint(void *data)
 }
 
 WL_EXPORT void
+weston_layer_entry_insert(struct weston_layer_entry *list,
+			  struct weston_layer_entry *entry)
+{
+	wl_list_insert(&list->link, &entry->link);
+	entry->layer = list->layer;
+}
+
+WL_EXPORT void
+weston_layer_entry_remove(struct weston_layer_entry *entry)
+{
+	wl_list_remove(&entry->link);
+	wl_list_init(&entry->link);
+	entry->layer = NULL;
+}
+
+WL_EXPORT void
 weston_layer_init(struct weston_layer *layer, struct wl_list *below)
 {
-	wl_list_init(&layer->view_list);
+	wl_list_init(&layer->view_list.link);
+	layer->view_list.layer = layer;
 	if (below != NULL)
 		wl_list_insert(below, &layer->link);
 }
diff --git a/src/compositor.h b/src/compositor.h
index 6bd637e..94376f3 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -516,8 +516,13 @@ enum {
                                          * to off */
 };
 
+struct weston_layer_entry {
+	struct wl_list link;
+	struct weston_layer *layer;
+};
+
 struct weston_layer {
-	struct wl_list view_list;
+	struct weston_layer_entry view_list;
 	struct wl_list link;
 };
 
@@ -747,7 +752,7 @@ struct weston_view {
 	struct wl_signal destroy_signal;
 
 	struct wl_list link;
-	struct wl_list layer_link;
+	struct weston_layer_entry layer_link;
 	struct weston_plane *plane;
 
 	pixman_region32_t clip;
@@ -973,6 +978,11 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
 	     wl_fixed_t x, wl_fixed_t y, int touch_type);
 
 void
+weston_layer_entry_insert(struct weston_layer_entry *list,
+			  struct weston_layer_entry *entry);
+void
+weston_layer_entry_remove(struct weston_layer_entry *entry);
+void
 weston_layer_init(struct weston_layer *layer, struct wl_list *below);
 
 void
diff --git a/src/data-device.c b/src/data-device.c
index 483e22e..ce735d1 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -187,7 +187,7 @@ drag_surface_configure(struct weston_drag *drag,
 		       struct weston_surface *es,
 		       int32_t sx, int32_t sy)
 {
-	struct wl_list *list;
+	struct weston_layer_entry *list;
 	float fx, fy;
 
 	assert((pointer != NULL && touch == NULL) ||
@@ -200,8 +200,8 @@ drag_surface_configure(struct weston_drag *drag,
 		else
 			list = &es->compositor->cursor_layer.view_list;
 
-		wl_list_remove(&drag->icon->layer_link);
-		wl_list_insert(list, &drag->icon->layer_link);
+		weston_layer_entry_remove(&drag->icon->layer_link);
+		weston_layer_entry_insert(list, &drag->icon->layer_link);
 		weston_view_update_transform(drag->icon);
 		empty_region(&es->pending.input);
 	}
diff --git a/src/input.c b/src/input.c
index f4944b6..9d3c336 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1471,8 +1471,8 @@ pointer_cursor_surface_configure(struct weston_surface *es,
 	empty_region(&es->pending.input);
 
 	if (!weston_surface_is_mapped(es)) {
-		wl_list_insert(&es->compositor->cursor_layer.view_list,
-			       &pointer->sprite->layer_link);
+		weston_layer_entry_insert(&es->compositor->cursor_layer.view_list,
+					  &pointer->sprite->layer_link);
 		weston_view_update_transform(pointer->sprite);
 	}
 }
diff --git a/tests/weston-test.c b/tests/weston-test.c
index 844059d..0268195 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -87,9 +87,9 @@ test_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
 	struct weston_test_surface *test_surface = surface->configure_private;
 	struct weston_test *test = test_surface->test;
 
-	if (wl_list_empty(&test_surface->view->layer_link))
-		wl_list_insert(&test->layer.view_list,
-			       &test_surface->view->layer_link);
+	if (wl_list_empty(&test_surface->view->layer_link.link))
+		weston_layer_entry_insert(&test->layer.view_list,
+					  &test_surface->view->layer_link);
 
 	weston_view_set_position(test_surface->view,
 				 test_surface->x, test_surface->y);
-- 
1.8.5.1



More information about the wayland-devel mailing list