tests: xdg-client-helper: Add maybe_ack_configure() helper

So users are not forced to use xdg_surface_commit_solid().

Signed-off-by: Robert Mader <robert.mader@collabora.com>
This commit is contained in:
Robert Mader 2025-10-08 13:50:06 +02:00
parent a1c0d33700
commit 18076228d3
2 changed files with 15 additions and 5 deletions

View file

@ -161,6 +161,17 @@ xdg_surface_wait_configure(struct xdg_surface_data *xdg_surface)
test_assert_u32_gt(xdg_surface->configure.serial, 0);
}
void
xdg_surface_maybe_ack_configure(struct xdg_surface_data *xdg_surface)
{
if (xdg_surface->configure.serial == 0)
return;
xdg_surface_ack_configure(xdg_surface->xdg_surface,
xdg_surface->configure.serial);
xdg_surface->configure.serial = 0;
}
void
xdg_surface_commit_solid(struct xdg_surface_data *xdg_surface,
uint8_t r, uint8_t g, uint8_t b)
@ -191,11 +202,7 @@ xdg_surface_commit_solid(struct xdg_surface_data *xdg_surface,
wl_surface_damage_buffer(xdg_surface->surface->wl_surface,
0, 0, width, height);
if (xdg_surface->configure.serial > 0) {
xdg_surface_ack_configure(xdg_surface->xdg_surface,
xdg_surface->configure.serial);
xdg_surface->configure.serial = 0;
}
xdg_surface_maybe_ack_configure(xdg_surface);
xdg_surface->surface->width = width;
xdg_surface->surface->height = height;

View file

@ -73,6 +73,9 @@ xdg_surface_make_toplevel(struct xdg_surface_data *xdg_surface,
void
xdg_surface_wait_configure(struct xdg_surface_data *xdg_surface);
void
xdg_surface_maybe_ack_configure(struct xdg_surface_data *xdg_surface);
struct xdg_surface_data *
create_xdg_surface(struct xdg_client *xdg_client);