[PATCH weston 2/5] window: Honour opaque field for windows without a frame
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Fri Nov 30 07:34:23 PST 2012
Since the opaque region was set in frame_resize_handler(), if a client
created a frameless window setting the toplevel widget as opaque would
have no effect.
This patch fixes this by moving the call wl_surface_set_opaque_region()
to idle_resize(), and changing the latter function to set the whole
window as opaque if its toplevel widget has the opaque flag set.
---
clients/window.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/clients/window.c b/clients/window.c
index 3469fe6..e96a4dd 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1715,14 +1715,11 @@ frame_resize_handler(struct widget *widget,
widget_set_allocation(widget, 0, 0, width, height);
- if (child->opaque) {
- widget->window->opaque_region =
- wl_compositor_create_region(display->compositor);
+ if (child->opaque)
wl_region_add(widget->window->opaque_region,
opaque_margin, opaque_margin,
widget->allocation.width - 2 * opaque_margin,
widget->allocation.height - 2 * opaque_margin);
- }
/* frame internal buttons */
x_r = frame->widget->allocation.width - t->width - shadow_margin;
@@ -3077,6 +3074,7 @@ static void
idle_resize(struct window *window)
{
struct widget *widget;
+ struct wl_compositor *compositor = window->display->compositor;
window->resize_needed = 0;
widget = window->widget;
@@ -3091,10 +3089,10 @@ idle_resize(struct window *window)
window->input_region = NULL;
}
- if (window->opaque_region) {
+ if (window->opaque_region)
wl_region_destroy(window->opaque_region);
- window->opaque_region = NULL;
- }
+
+ window->opaque_region = wl_compositor_create_region(compositor);
if (widget->resize_handler)
widget->resize_handler(widget,
@@ -3107,6 +3105,11 @@ idle_resize(struct window *window)
window->allocation = widget->allocation;
window_schedule_redraw(window);
}
+
+ if (widget->opaque)
+ wl_region_add(window->opaque_region, 0, 0,
+ widget->allocation.width,
+ widget->allocation.height);
}
void
--
1.7.10.4
More information about the wayland-devel
mailing list