[RFC weston] libweston: Do not include subsurfaces with NULL buffer in bounding box

Philipp Kerling pkerling at casix.org
Fri Jul 28 14:41:26 UTC 2017


I was pondering how to remove the window decorations of my application
(which live in subsurfaces) when going full screen without flickering.

At first I just destroyed the surfaces, but that lead to flicker
(window without decoration will appear for one frame before the full
screen application is displayed) since subsurface destruction is not
specified to be synchronized to the commit of the main surface.

Then I tried attaching a NULL wl_buffer to the surfaces. This works and
does not flicker, but it has the problem that weston will disconnect my
application when going to full screen for violating the configured
xdg_shell buffer size. The reason seems to be that attaching a NULL
wl_buffer does not reset the surface size and
weston_surface_get_bounding_box still thinks that the surface has the
prior size.

The patch fixes this by checking explicitly for the buffer and is
confirmed to fix the issue, but I am not sure whether this is the right
solution. Maybe surface->width and surface->height should be set to 0
anyway?

---
 libweston/compositor.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index 813b6634..747c5ebc 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -3621,11 +3621,16 @@ weston_surface_get_bounding_box(struct weston_surface *surface)
 				  surface->width, surface->height);
 
 	wl_list_for_each(subsurface, &surface->subsurface_list, parent_link)
-		pixman_region32_union_rect(&region, &region,
-					   subsurface->position.x,
-					   subsurface->position.y,
-					   subsurface->surface->width,
-					   subsurface->surface->height);
+	{
+		if (subsurface->surface->buffer_ref.buffer)
+		{
+			pixman_region32_union_rect(&region, &region,
+						   subsurface->position.x,
+						   subsurface->position.y,
+						   subsurface->surface->width,
+						   subsurface->surface->height);
+		}
+	}
 
 	box = pixman_region32_extents(&region);
 	struct weston_geometry geometry = {


More information about the wayland-devel mailing list