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 <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2022-01-24 14:49:30 +02:00 committed by Pekka Paalanen
parent 90687e1fc6
commit e948bd4bc9

View file

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