From 3e28588bb61c76bd668b51d931f522074faa50e2 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sat, 11 Mar 2023 11:18:48 -0500
Subject: [PATCH] wayland: Never use the cached size for maximized or tiled
windows
Don't use the cached floating window size for maximized or tiled windows. Fixes the initial window size when creating a window with the maximized flag set.
---
src/video/wayland/SDL_waylandwindow.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 04d1786b5734..46f5891a5e90 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -843,8 +843,9 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
*
* https://gitlab.gnome.org/jadahl/libdecor/-/issues/40
*/
- const SDL_bool use_cached_size = (floating && !wind->floating) ||
- (window->is_hiding || !!(window->flags & SDL_WINDOW_HIDDEN));
+ const SDL_bool use_cached_size = !maximized && !tiled &&
+ ((floating && !wind->floating) ||
+ (window->is_hiding || (window->flags & SDL_WINDOW_HIDDEN)));
/* This will never set 0 for width/height unless the function returns false */
if (use_cached_size || !libdecor_configuration_get_content_size(configuration, frame, &width, &height)) {