From 6519158ae53b3516ba06571b8a2a1a69c0d30d1a Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 24 Sep 2025 09:57:55 -0400 Subject: [PATCH] wayland: Ignore bogus libdecor content sizes if an unmapped window is suspended If a client takes a long time to present the first frame after creating the window, a configure event to set the suspended state may arrive with libdecor increasing the content size by the decoration dimensions, which should be ignored. (cherry picked from commit 9d5d7010debcb2a3c78e6f88365f453bdb923edf) --- src/video/wayland/SDL_waylandwindow.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 78cd5d678f..978e292c5a 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -1295,8 +1295,13 @@ static void decoration_frame_configure(struct libdecor_frame *frame, } else { /* Don't apply the supplied dimensions if they haven't changed from the last configuration * event, or a newer size set programmatically can be overwritten by old data. + * + * If a client takes a long time to present the first frame after creating the window, a + * configure event to set the suspended state may arrive with the content size increased + * by the decoration dimensions, which should also be ignored. */ - if (width != wind->last_configure.width || height != wind->last_configure.height) { + if ((width != wind->last_configure.width || height != wind->last_configure.height) && + !(wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME && wind->suspended != suspended)) { wind->requested.logical_width = width; wind->requested.logical_height = height;