From baacbeb4c4a8e0a6dab302cc9ecb0faf5e9f300c Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Thu, 23 May 2024 10:51:44 -0400 Subject: [PATCH] wayland: Make sure the correct cached window dimensions are used when a config size of 0,0 is received The window may be in a maximized or tiled state, in which case, don't use the floating size. --- src/video/wayland/SDL_waylandwindow.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 178efc1312..4f379dbdd8 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -777,11 +777,18 @@ static void handle_configure_xdg_toplevel(void *data, if (window->flags & SDL_WINDOW_RESIZABLE) { if ((floating && !wind->floating) || width == 0 || height == 0) { - /* This happens when we're being restored from a - * non-floating state, so use the cached floating size here. + /* This happens when we're being restored from a non-floating state, + * or the compositor indicates that the size is up to the client, so + * used the cached window size here. */ - width = window->floating.w; - height = window->floating.h; + if (floating) { + width = window->floating.w; + height = window->floating.h; + } else { + width = window->windowed.w; + height = window->windowed.h; + } + if (wind->scale_to_display) { wind->requested.logical_width = PixelToPoint(window, width); wind->requested.logical_height = PixelToPoint(window, height);