From e948bd4bc9f76eb3d4364008178cd2a2bd0b9856 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 24 Jan 2022 14:49:30 +0200 Subject: [PATCH] tests: give name for the test-shell background Give a role and a label for the test desktop shell background surface. This makes it easier reading scenegraph dumps and other surface related debug messages in tests when you don't have to guess what this mysterious "PID 0, surface ID 0" surface is. Signed-off-by: Pekka Paalanen --- tests/weston-test-desktop-shell.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/weston-test-desktop-shell.c b/tests/weston-test-desktop-shell.c index 6733246f..91654baa 100644 --- a/tests/weston-test-desktop-shell.c +++ b/tests/weston-test-desktop-shell.c @@ -157,6 +157,12 @@ static const struct weston_desktop_api shell_desktop_api = { .pong = desktop_surface_pong, }; +static int +background_get_label(struct weston_surface *surface, char *buf, size_t len) +{ + return snprintf(buf, len, "test desktop shell background"); +} + static void shell_destroy(struct wl_listener *listener, void *data) { @@ -210,6 +216,10 @@ wet_shell_init(struct weston_compositor *ec, if (dts->background_view == NULL) goto out_surface; + weston_surface_set_role(dts->background_surface, + "test-desktop background", NULL, 0); + weston_surface_set_label_func(dts->background_surface, + background_get_label); weston_surface_set_color(dts->background_surface, 0.16, 0.32, 0.48, 1.); pixman_region32_fini(&dts->background_surface->opaque); pixman_region32_init_rect(&dts->background_surface->opaque, 0, 0, 2000, 2000);