SDL: Merge commit 'c69fde348fafcb90200a148b711137c464ffa7de' into main

From c69fde348fafcb90200a148b711137c464ffa7de Mon Sep 17 00:00:00 2001
From: Ethan Lee <[EMAIL REDACTED]>
Date: Sun, 2 May 2021 16:43:01 -0400
Subject: [PATCH] wayland: Maximize/Restore should set the relevant window
 flags.

Also, Maximize should be ignored for fixed-size windows.
---
 src/video/wayland/SDL_waylandwindow.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index a6ff2fb92..54502308c 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -850,6 +850,11 @@ Wayland_RestoreWindow(_THIS, SDL_Window * window)
     SDL_WindowData *wind = window->driverdata;
     const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata;
 
+    /* Set this flag now even if we never actually maximized, eventually
+     * ShowWindow will take care of it along with the other window state.
+     */
+    window->flags &= ~SDL_WINDOW_MAXIMIZED;
+
     /* Note that xdg-shell does NOT provide a way to unset minimize! */
     if (viddata->shell.xdg) {
         if (wind->shell_surface.xdg.roleobj.toplevel == NULL) {
@@ -894,6 +899,15 @@ Wayland_MaximizeWindow(_THIS, SDL_Window * window)
     SDL_WindowData *wind = window->driverdata;
     SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
 
+    if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
+        return;
+    }
+
+    /* Set this flag now even if we don't actually maximize yet, eventually
+     * ShowWindow will take care of it along with the other window state.
+     */
+    window->flags |= SDL_WINDOW_MAXIMIZED;
+
     if (viddata->shell.xdg) {
         if (wind->shell_surface.xdg.roleobj.toplevel == NULL) {
             return; /* Can't do anything yet, wait for ShowWindow */