Commit ac904b8e95c617b0000563b53a7272799ab2e9df

Christian Rauch 2021-06-21T01:25:25

wayland: ignore resize in fullscreen or maximised mode

diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index d33c4e8..f44da98 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 7564b27..88df1af 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 b4e89b3..8a19b36 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) {