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; 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); -- 1.7.11.2 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel