[PATCH weston 2/2] weston-test: don't map surfaces that have no content

Emilio Pozuelo Monfort pochu27 at gmail.com
Mon Jul 9 15:24:59 UTC 2018


If a surface has no content (e.g. no buffer), then it shouldn't
be mapped, so that its subsurfaces don't get mapped either.

This works fine in the desktop-shell, but is currently broken
on the weston-test module.

https://bugs.freedesktop.org/show_bug.cgi?id

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo at collabora.co.uk>
---
 tests/weston-test.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/weston-test.c b/tests/weston-test.c
index 412eb243..b67bd9fd 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -157,12 +157,21 @@ notify_pointer_position(struct weston_test *test, struct wl_resource *resource)
 	weston_test_send_pointer_position(resource, pointer->x, pointer->y);
 }
 
+static bool
+surface_has_content(struct weston_surface *surface)
+{
+	return surface->width > 0 && surface->height > 0;
+}
+
 static void
 test_surface_committed(struct weston_surface *surface, int32_t sx, int32_t sy)
 {
 	struct weston_test_surface *test_surface = surface->committed_private;
 	struct weston_test *test = test_surface->test;
 
+	if (!surface_has_content(surface))
+		return;
+
 	if (wl_list_empty(&test_surface->view->layer_link.link))
 		weston_layer_entry_insert(&test->layer.view_list,
 					  &test_surface->view->layer_link);
-- 
2.18.0



More information about the wayland-devel mailing list