[PATCH 2/2 weston] toytoolkit: Don't draw shadows for maximized windows.
Ander Conselvan de Oliveira
conselvan2 at gmail.com
Tue Aug 7 02:22:05 PDT 2012
On 08/07/2012 09:32 AM, Scott Moreau wrote:
> This effectively fixes a bug where maximized windows appear to not maximize
> fully bacause of the shadow margin. Instead, we now maximize the window to
> the understood input region.
> ---
> clients/window.c | 60 ++++++++++++++++++++++++++++++++++++++++----------------
> 1 file changed, 43 insertions(+), 17 deletions(-)
>
> diff --git a/clients/window.c b/clients/window.c
> index 30a6167..8f5cf9b 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -181,6 +181,7 @@ struct widget {
> void *user_data;
> int opaque;
> int tooltip_count;
> + int shadow_margin;
> };
>
> struct input {
> @@ -921,6 +922,7 @@ widget_create(struct window *window, void *data)
> widget->opaque = 0;
> widget->tooltip = NULL;
> widget->tooltip_count = 0;
> + widget->shadow_margin = window->display->theme->margin;
>
> return widget;
> }
> @@ -1246,7 +1248,38 @@ frame_resize_handler(struct widget *widget,
> int decoration_width, decoration_height;
> int opaque_margin;
>
> - if (widget->window->type != TYPE_FULLSCREEN) {
> + switch (widget->window->type) {
> + case TYPE_FULLSCREEN:
> + decoration_width = 0;
> + decoration_height = 0;
> +
> + allocation.x = 0;
> + allocation.y = 0;
> + allocation.width = width;
> + allocation.height = height;
> + opaque_margin = 0;
> +
> + wl_list_for_each(button, &frame->buttons_list, link)
> + button->widget->opaque = 0;
> + break;
> + case TYPE_MAXIMIZED:
> + widget->shadow_margin = t->margin;
> + t->margin = 0;
> + decoration_width = t->width * 2;
> + decoration_height = t->width + t->titlebar_height;
> +
> + allocation.x = t->width;
> + allocation.y = t->titlebar_height;
> + allocation.width = width - decoration_width;
> + allocation.height = height - decoration_height;
> +
> + opaque_margin = 0;
> +
> + wl_list_for_each(button, &frame->buttons_list, link)
> + button->widget->opaque = 1;
> + break;
> + default:
> + t->margin = widget->shadow_margin;
You shouldn't change the theme data. With your patch applied, run
weston-terminal, press ctrl-alt-n, maximize the new terminal window and
then use mod-alt to switch back to the other terminal. The frame is not
drawn properly anymore.
Cheers,
Ander
> decoration_width = (t->width + t->margin) * 2;
> decoration_height = t->width +
> t->titlebar_height + t->margin * 2;
> @@ -1260,18 +1293,7 @@ frame_resize_handler(struct widget *widget,
>
> wl_list_for_each(button, &frame->buttons_list, link)
> button->widget->opaque = 1;
> - } else {
> - decoration_width = 0;
> - decoration_height = 0;
> -
> - allocation.x = 0;
> - allocation.y = 0;
> - allocation.width = width;
> - allocation.height = height;
> - opaque_margin = 0;
> -
> - wl_list_for_each(button, &frame->buttons_list, link)
> - button->widget->opaque = 0;
> + break;
> }
>
> widget_set_allocation(child, allocation.x, allocation.y,
> @@ -1289,10 +1311,14 @@ frame_resize_handler(struct widget *widget,
> if (widget->window->type != TYPE_FULLSCREEN) {
> widget->window->input_region =
> wl_compositor_create_region(display->compositor);
> - wl_region_add(widget->window->input_region,
> - t->margin, t->margin,
> - width - 2 * t->margin,
> - height - 2 * t->margin);
> + if (widget->window->type == TYPE_MAXIMIZED)
> + wl_region_add(widget->window->input_region,
> + t->margin, t->margin, width, height);
> + else
> + wl_region_add(widget->window->input_region,
> + t->margin, t->margin,
> + width - 2 * t->margin,
> + height - 2 * t->margin);
> }
>
> widget_set_allocation(widget, 0, 0, width, height);
>
More information about the wayland-devel
mailing list