[PATCH 1/2 weston] toytoolkit: Correct improper usage of opaque for button widgets.

Ander Conselvan de Oliveira conselvan2 at gmail.com
Tue Aug 7 01:57:07 PDT 2012


What exactly does this fix? Your commit message doesn't make it that 
obvious.

Weston commit 010f98b0 added the opaque field to struct widget to "track 
and report [...] opaque regions", i.e., the region of a surface whose 
alpha channel is 1. It seems to me the frame button code is abusing this 
field to hide the buttons in fullscreen mode. IMO, either way you define 
a visibility value based on the opacity value results in improper usage.

Cheers,
Ander

On 08/07/2012 09:32 AM, Scott Moreau wrote:
> ---
>   clients/window.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/clients/window.c b/clients/window.c
> index d0b7a7d..30a6167 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -1259,7 +1259,7 @@ frame_resize_handler(struct widget *widget,
>   		opaque_margin = t->margin + t->frame_radius;
>
>   		wl_list_for_each(button, &frame->buttons_list, link)
> -			button->widget->opaque = 0;
> +			button->widget->opaque = 1;
>   	} else {
>   		decoration_width = 0;
>   		decoration_height = 0;
> @@ -1271,7 +1271,7 @@ frame_resize_handler(struct widget *widget,
>   		opaque_margin = 0;
>
>   		wl_list_for_each(button, &frame->buttons_list, link)
> -			button->widget->opaque = 1;
> +			button->widget->opaque = 0;
>   	}
>
>   	widget_set_allocation(child, allocation.x, allocation.y,
> @@ -1416,7 +1416,7 @@ frame_button_redraw_handler(struct widget *widget, void *data)
>   		return;
>   	if (!height)
>   		return;
> -	if (widget->opaque)
> +	if (!widget->opaque)
>   		return;
>
>   	cr = cairo_create(window->cairo_surface);
>



More information about the wayland-devel mailing list