SDL: wayland: Make sure the logical window size can't go to zero.

From 879ba46adefdbe23e9a1b3e868a45ef9db82c61d Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Wed, 24 Jan 2024 11:24:16 -0500
Subject: [PATCH] wayland: Make sure the logical window size can't go to zero.

libdecor can send a size of zero as a valid value, the use of which will close the window. Make sure the minimum width/height are clamped to a minimum of 1.
---
 src/video/wayland/SDL_waylandwindow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index fb69334223d9..470e7f10de54 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1714,6 +1714,10 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
         wl_surface_commit(data->surface);
     }
 
+    /* Make sure the window can't be resized to 0 or it can be spuriously closed by the window manager. */
+    data->system_limits.min_width = SDL_max(data->system_limits.min_width, 1);
+    data->system_limits.min_height = SDL_max(data->system_limits.min_height, 1);
+
     /* Unlike the rest of window state we have to set this _after_ flushing the
      * display, because we need to create the decorations before possibly hiding
      * them immediately afterward.