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

Submitted by Emilio Pozuelo Monfort on July 9, 2018, 3:24 p.m.

Details

Message ID 20180709152459.21057-3-emilio.pozuelo@collabora.co.uk
State New
Headers show

Patch hide | download patch | download mbox

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);