SDL: wayland: ignore resize in fullscreen or maximised mode

From ac904b8e95c617b0000563b53a7272799ab2e9df Mon Sep 17 00:00:00 2001
From: Christian Rauch <[EMAIL REDACTED]>
Date: Mon, 21 Jun 2021 01:25:25 +0100
Subject: [PATCH] wayland: ignore resize in fullscreen or maximised mode

---
 src/video/wayland/SDL_waylanddyn.h    | 1 +
 src/video/wayland/SDL_waylandsym.h    | 1 +
 src/video/wayland/SDL_waylandwindow.c | 9 +++++++++
 3 files changed, 11 insertions(+)

diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index d33c4e8e1b..f44da989eb 100644
--- a/src/video/wayland/SDL_waylanddyn.h
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -141,6 +141,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
 #define libdecor_frame_has_capability (*WAYLAND_libdecor_frame_has_capability)
 #define libdecor_frame_set_visibility (*WAYLAND_libdecor_frame_set_visibility)
 #define libdecor_frame_is_visible (*WAYLAND_libdecor_frame_is_visible)
+#define libdecor_frame_is_floating (*WAYLAND_libdecor_frame_is_floating)
 #define libdecor_frame_map (*WAYLAND_libdecor_frame_map)
 #define libdecor_state_new (*WAYLAND_libdecor_state_new)
 #define libdecor_state_free (*WAYLAND_libdecor_state_free)
diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h
index 7564b27435..88df1afb00 100644
--- a/src/video/wayland/SDL_waylandsym.h
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -180,6 +180,7 @@ SDL_WAYLAND_SYM(bool, libdecor_frame_has_capability, (struct libdecor_frame *, \
                                                       enum libdecor_capabilities))
 SDL_WAYLAND_SYM(void, libdecor_frame_set_visibility, (struct libdecor_frame *, bool))
 SDL_WAYLAND_SYM(bool, libdecor_frame_is_visible, (struct libdecor_frame *))
+SDL_WAYLAND_SYM(bool, libdecor_frame_is_floating, (struct libdecor_frame *))
 SDL_WAYLAND_SYM(void, libdecor_frame_map, (struct libdecor_frame *))
 SDL_WAYLAND_SYM(struct libdecor_state *, libdecor_state_new, (int, int))
 SDL_WAYLAND_SYM(void, libdecor_state_free, (struct libdecor_state *))
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index b4e89b3f2a..8a19b36e6a 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1544,6 +1544,15 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window)
     struct libdecor_state *state;
 #endif
 
+#ifdef HAVE_LIBDECOR_H
+    /* we must not resize the window while we have a static (non-floating) size */
+    if (data->shell.libdecor &&
+        wind->shell_surface.libdecor.frame &&
+        !libdecor_frame_is_floating(wind->shell_surface.libdecor.frame)) {
+            return;
+    }
+#endif
+
     wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window));
 
     if (wind->egl_window) {