SDL: Fixed view frame from flipping back and forth between landscape and portrait on iOS

From b2d913883c39e0a53e55eb9286d7e442d565554e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 23 Feb 2023 09:14:53 -0800
Subject: [PATCH] Fixed view frame from flipping back and forth between
 landscape and portrait on iOS

---
 src/video/uikit/SDL_uikitvideo.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m
index 4377b90737d0..f12df8bdeae2 100644
--- a/src/video/uikit/SDL_uikitvideo.m
+++ b/src/video/uikit/SDL_uikitvideo.m
@@ -204,7 +204,8 @@ int UIKit_SuspendScreenSaver(_THIS)
      * https://bugzilla.libsdl.org/show_bug.cgi?id=3465
      * https://forums.developer.apple.com/thread/65337 */
     UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation;
-    BOOL landscape = UIInterfaceOrientationIsLandscape(orient);
+    BOOL landscape = UIInterfaceOrientationIsLandscape(orient) ||
+                    !(UIKit_GetSupportedOrientations(window) & (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown));
     BOOL fullscreen = CGRectEqualToRect(screen.bounds, frame);
 
     /* The orientation flip doesn't make sense when the window is smaller