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

From a3a45f670907087c794f1f1ee075d3c0dedfe4d0 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

(cherry picked from commit b2d913883c39e0a53e55eb9286d7e442d565554e)
---
 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 64cff193b6c1..b52d84e83daa 100644
--- a/src/video/uikit/SDL_uikitvideo.m
+++ b/src/video/uikit/SDL_uikitvideo.m
@@ -220,7 +220,8 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
      * 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