From f23e1218e36e4802de183645d398236fab20e239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 25 Mar 2024 13:25:00 +0100 Subject: [PATCH] tests/wayland/client/utils: Add way to mark surface as opaque Part-of: --- .../wayland-test-clients/wayland-test-client-utils.c | 11 +++++++++++ .../wayland-test-clients/wayland-test-client-utils.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/tests/wayland-test-clients/wayland-test-client-utils.c b/src/tests/wayland-test-clients/wayland-test-client-utils.c index 918fda0f6..146bb4bb9 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.c +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.c @@ -550,11 +550,16 @@ handle_xdg_surface_configure (void *data, uint32_t serial) { WaylandSurface *surface = data; + struct wl_region *opaque_region; draw_surface (surface->display, surface->wl_surface, surface->width, surface->height, surface->color); + opaque_region = wl_compositor_create_region (surface->display->compositor); + wl_region_add (opaque_region, 0, 0, surface->width, surface->height); + wl_surface_set_opaque_region (surface->wl_surface, opaque_region); + wl_region_destroy (opaque_region); xdg_surface_ack_configure (xdg_surface, serial); wl_surface_commit (surface->wl_surface); @@ -631,6 +636,12 @@ wayland_surface_has_state (WaylandSurface *surface, return g_hash_table_contains (surface->current_state, GUINT_TO_POINTER (state)); } +void +wayland_surface_set_opaque (WaylandSurface *surface) +{ + surface->is_opaque = TRUE; +} + const char * lookup_property_value (WaylandDisplay *display, const char *name) diff --git a/src/tests/wayland-test-clients/wayland-test-client-utils.h b/src/tests/wayland-test-clients/wayland-test-client-utils.h index 31779c4ac..f0306fec2 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.h +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.h @@ -79,6 +79,7 @@ typedef struct _WaylandSurface int height; uint32_t color; + gboolean is_opaque; } WaylandSurface; #define WAYLAND_TYPE_SURFACE (wayland_surface_get_type ()) @@ -109,6 +110,8 @@ WaylandSurface * wayland_surface_new (WaylandDisplay *display, gboolean wayland_surface_has_state (WaylandSurface *surface, enum xdg_toplevel_state state); +void wayland_surface_set_opaque (WaylandSurface *surface); + void draw_surface (WaylandDisplay *display, struct wl_surface *surface, int width,