[PATCH 1/3] Move animation_list to weston_output.

Scott Moreau oreaus at gmail.com
Fri Jun 8 18:40:53 PDT 2012


---
 src/compositor.c |   10 +++++++---
 src/compositor.h |    2 +-
 src/util.c       |    4 ++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 700f31b..d706b41 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1060,7 +1060,7 @@ weston_output_repaint(struct weston_output *output, int msecs)
 		wl_resource_destroy(&cb->resource);
 	}
 
-	wl_list_for_each_safe(animation, next, &ec->animation_list, link)
+	wl_list_for_each_safe(animation, next, &output->animation_list, link)
 		animation->frame(animation, output, msecs);
 }
 
@@ -1142,9 +1142,13 @@ weston_compositor_schedule_repaint(struct weston_compositor *compositor)
 WL_EXPORT void
 weston_compositor_fade(struct weston_compositor *compositor, float tint)
 {
+	struct weston_output *output;
 	struct weston_surface *surface;
 	int done;
 
+	output = container_of(compositor->output_list.next,
+                             struct weston_output, link);
+
 	done = weston_spring_done(&compositor->fade.spring);
 	compositor->fade.spring.target = tint;
 	if (weston_spring_done(&compositor->fade.spring))
@@ -1167,7 +1171,7 @@ weston_compositor_fade(struct weston_compositor *compositor, float tint)
 
 	weston_surface_damage(compositor->fade.surface);
 	if (wl_list_empty(&compositor->fade.animation.link))
-		wl_list_insert(compositor->animation_list.prev,
+		wl_list_insert(output->animation_list.prev,
 			       &compositor->fade.animation.link);
 }
 
@@ -2840,6 +2844,7 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
 
 	wl_signal_init(&output->frame_signal);
 	wl_list_init(&output->frame_callback_list);
+	wl_list_init(&output->animation_list);
 	wl_list_init(&output->resource_list);
 
 	output->id = ffs(~output->compositor->output_id_pool) - 1;
@@ -2990,7 +2995,6 @@ weston_compositor_init(struct weston_compositor *ec,
 	wl_list_init(&ec->key_binding_list);
 	wl_list_init(&ec->button_binding_list);
 	wl_list_init(&ec->axis_binding_list);
-	wl_list_init(&ec->animation_list);
 	weston_spring_init(&ec->fade.spring, 30.0, 1.0, 1.0);
 	ec->fade.animation.frame = fade_frame;
 	wl_list_init(&ec->fade.animation.link);
diff --git a/src/compositor.h b/src/compositor.h
index 646e1e7..e353070 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -131,6 +131,7 @@ struct weston_output {
 	struct weston_compositor *compositor;
 	struct weston_matrix matrix;
 	struct wl_list frame_callback_list;
+	struct wl_list animation_list;
 	int32_t x, y, mm_width, mm_height;
 	struct weston_border border;
 	pixman_region32_t region;
@@ -287,7 +288,6 @@ struct weston_compositor {
 	struct wl_list key_binding_list;
 	struct wl_list button_binding_list;
 	struct wl_list axis_binding_list;
-	struct wl_list animation_list;
 	struct {
 		struct weston_spring spring;
 		struct weston_animation animation;
diff --git a/src/util.c b/src/util.c
index 3d28f8f..97058fe 100644
--- a/src/util.c
+++ b/src/util.c
@@ -188,7 +188,7 @@ weston_zoom_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
 	wl_signal_add(&surface->surface.resource.destroy_signal,
 		      &zoom->listener);
 
-	wl_list_insert(&surface->compositor->animation_list,
+	wl_list_insert(&surface->output->animation_list,
 		       &zoom->animation.link);
 
 	return zoom;
@@ -510,7 +510,7 @@ weston_fade_run(struct weston_surface *surface,
 	wl_signal_add(&surface->surface.resource.destroy_signal,
 		      &fade->listener);
 
-	wl_list_insert(&surface->compositor->animation_list,
+	wl_list_insert(&surface->output->animation_list,
 		       &fade->animation.link);
 
 	return fade;
-- 
1.7.7.6



More information about the wayland-devel mailing list