After the fade or zoom effects, alpha could not have been 1.0, preventing not redrawing behind opaque windows.
This patch add a reset function in weston_surface_animation to reset some variables the effects affect. Signed-off-by: Axel Davy <axel.d...@ens.fr> --- src/animation.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/animation.c b/src/animation.c index 0b2fa95..7438111 100644 --- a/src/animation.c +++ b/src/animation.c @@ -124,6 +124,7 @@ struct weston_surface_animation { struct wl_listener listener; float start, stop; weston_surface_animation_frame_func_t frame; + weston_surface_animation_frame_func_t reset; weston_surface_animation_done_func_t done; void *data; }; @@ -134,6 +135,8 @@ weston_surface_animation_destroy(struct weston_surface_animation *animation) wl_list_remove(&animation->animation.link); wl_list_remove(&animation->listener.link); wl_list_remove(&animation->transform.link); + if (animation->reset) + animation->reset(animation); weston_surface_geometry_dirty(animation->surface); if (animation->done) animation->done(animation, animation->data); @@ -179,6 +182,7 @@ static struct weston_surface_animation * weston_surface_animation_run(struct weston_surface *surface, float start, float stop, weston_surface_animation_frame_func_t frame, + weston_surface_animation_frame_func_t reset, weston_surface_animation_done_func_t done, void *data) { @@ -190,6 +194,7 @@ weston_surface_animation_run(struct weston_surface *surface, animation->surface = surface; animation->frame = frame; + animation->reset = reset; animation->done = done; animation->data = data; animation->start = start; @@ -213,6 +218,14 @@ weston_surface_animation_run(struct weston_surface *surface, } static void +reset_alpha(struct weston_surface_animation *animation) +{ + struct weston_surface *surface = animation->surface; + + surface->alpha = animation->stop; +} + +static void zoom_frame(struct weston_surface_animation *animation) { struct weston_surface *es = animation->surface; @@ -242,7 +255,8 @@ weston_zoom_run(struct weston_surface *surface, float start, float stop, struct weston_surface_animation *zoom; zoom = weston_surface_animation_run(surface, start, stop, - zoom_frame, done, data); + zoom_frame, reset_alpha, + done, data); weston_spring_init(&zoom->spring, 300.0, start, stop); zoom->spring.friction = 1400; @@ -269,8 +283,9 @@ weston_fade_run(struct weston_surface *surface, { struct weston_surface_animation *fade; - fade = weston_surface_animation_run(surface, 0, 0, - fade_frame, done, data); + fade = weston_surface_animation_run(surface, 0, end, + fade_frame, reset_alpha, + done, data); weston_spring_init(&fade->spring, k, start, end); @@ -307,7 +322,8 @@ weston_slide_run(struct weston_surface *surface, float start, float stop, struct weston_surface_animation *animation; animation = weston_surface_animation_run(surface, start, stop, - slide_frame, done, data); + slide_frame, NULL, done, + data); if (!animation) return NULL; -- 1.8.1.2 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel