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

Scott Moreau oreaus at gmail.com
Tue Aug 7 04:03:50 PDT 2012

 Hi Ander,

On Tue, Aug 7, 2012 at 2:57 AM, Ander Conselvan de Oliveira <
conselvan2 at gmail.com> wrote:

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

I assumed the problem was obvious. The definition of the word opaque makes
it clear. In frame_button_redraw_handler() the code returns (i.e. does not
draw the buttons) if widget->opaque is set. It should be the other way

> 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.

I don't think this commit is relevant here. What is relevant is the meaning
of opaque. (since cgit.fd.o is down at the moment I will post some
snippets) For widget_set_transparent() you have

widget_set_transparent(struct widget *widget, int transparent)
    widget->opaque = !transparent;

> It seems to me the frame button code is abusing this field to hide the
> buttons in fullscreen mode.

This may be the case but see window.c~:1300 frame_resize_handler()

    if (child->opaque) {
        widget->window->opaque_region =
                  opaque_margin, opaque_margin,
                  widget->allocation.width - 2 * opaque_margin,
                  widget->allocation.height - 2 * opaque_margin);

it adds the region if opaque is set.

> IMO, either way you define a visibility value based on the opacity value
> results in improper usage.

I did not write this code, I'm just building on top of it while trying to
improve it. If you have a better idea, I would be interested to know what
you think.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20120807/ad57a19d/attachment.html>

More information about the wayland-devel mailing list