[PATCH weston] Restore alpha after fade or zoom effect.

Pekka Paalanen ppaalanen at gmail.com
Sun Sep 8 01:22:04 PDT 2013


On Sat,  7 Sep 2013 17:10:25 +0200
Axel Davy <axel.davy at ens.fr> wrote:

> After these effects, alpha could not have been 1.0, preventing
> not redrawing behind opaque windows.
> 
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
> ---
>  src/shell.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/shell.c b/src/shell.c
> index cd94aa5..d7e2d1e 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -3485,6 +3485,15 @@ weston_surface_set_initial_position (struct weston_surface *surface,
>  }
>  
>  static void
> +surface_restore_alpha(struct weston_surface_animation *animation, void *data)
> +{
> +	struct weston_surface *surface = data;
> +
> +	surface->alpha = 1.0;
> +	weston_surface_geometry_dirty(surface);
> +}
> +
> +static void
>  map(struct desktop_shell *shell, struct weston_surface *surface,
>      int32_t width, int32_t height, int32_t sx, int32_t sy)
>  {
> @@ -3576,10 +3585,12 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
>  	{
>  		switch (shell->win_animation_type) {
>  		case ANIMATION_FADE:
> -			weston_fade_run(surface, 0.0, 1.0, 300.0, NULL, NULL);
> +			weston_fade_run(surface, 0.0, 1.0, 300.0,
> +					surface_restore_alpha, surface);
>  			break;
>  		case ANIMATION_ZOOM:
> -			weston_zoom_run(surface, 0.5, 1.0, NULL, NULL);
> +			weston_zoom_run(surface, 0.5, 1.0, 
> +					surface_restore_alpha, surface);
>  			break;
>  		default:
>  			break;
> -- 

Hi,

the idea looks good to me!

OTOH, should weston_{fade,zoom}_run() guarantee that the animation
stops on exactly the given end value? It seems a bit odd to require
all callers to ensure, that the animation actually stops where it
was supposed to stop.


Thanks,
pq


More information about the wayland-devel mailing list