tests/wayland/client-utils: Allow creating role-less surfaces

This makes it easier to create e.g. subsurfaces or cursor surfaces that
inherit generic logic from the WaylandSurface test utility helper type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
This commit is contained in:
Jonas Ådahl 2025-01-08 12:07:03 +01:00 committed by Marge Bot
parent ff58ef4bb7
commit 7273f30234
2 changed files with 18 additions and 0 deletions

View File

@ -847,6 +847,22 @@ wayland_surface_new (WaylandDisplay *display,
return surface;
}
WaylandSurface *
wayland_surface_new_unassigned (WaylandDisplay *display)
{
WaylandSurface *surface;
surface = g_object_new (WAYLAND_TYPE_SURFACE, NULL);
surface->display = display;
surface->wl_surface = wl_compositor_create_surface (display->compositor);
wl_surface_add_listener (surface->wl_surface,
&surface_listener,
surface);
return surface;
}
gboolean
wayland_surface_has_state (WaylandSurface *surface,
enum xdg_toplevel_state state)

View File

@ -119,6 +119,8 @@ WaylandSurface * wayland_surface_new (WaylandDisplay *display,
int default_height,
uint32_t color);
WaylandSurface * wayland_surface_new_unassigned (WaylandDisplay *display);
gboolean wayland_surface_has_state (WaylandSurface *surface,
enum xdg_toplevel_state state);