From baf1e4f674033d65ef2375601ab21936ad426340 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sun, 11 Feb 2024 10:37:12 +0300 Subject: [PATCH] backend/wayland: don't ack a configure event too early Postpone sending xdg_surface.ack_configure until the guest compositor commits a buffer, if at all. Also see https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/128. --- backend/wayland/output.c | 8 +++++++- include/backend/wayland.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/wayland/output.c b/backend/wayland/output.c index ff58cc37..a783abe5 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -588,6 +588,11 @@ static bool output_commit(struct wlr_output *wlr_output, output->surface); } + if (output->has_configure_serial) { + xdg_surface_ack_configure(output->xdg_surface, output->configure_serial); + output->has_configure_serial = false; + } + wl_surface_commit(output->surface); if (wp_feedback != NULL) { @@ -742,7 +747,8 @@ static void xdg_surface_handle_configure(void *data, assert(output && output->xdg_surface == xdg_surface); output->configured = true; - xdg_surface_ack_configure(xdg_surface, serial); + output->has_configure_serial = true; + output->configure_serial = serial; int32_t req_width = output->wlr_output.width; int32_t req_height = output->wlr_output.height; diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 192891b4..4f9f382b 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -95,7 +95,10 @@ struct wlr_wl_output { // 0 if not requested int32_t requested_width, requested_height; + uint32_t configure_serial; + bool has_configure_serial; bool configured; + uint32_t enter_serial; struct {