iOS: Fix app orientation when creating a landscape fullscreen window with the device currently in portrait orientation.
authorAlex Szpakowski
Sat, 12 Aug 2017 22:16:04 -0300
changeset 1125649fe11ad0425
parent 11255 0302e7e91db7
child 11257 7561c9adebd4
iOS: Fix app orientation when creating a landscape fullscreen window with the device currently in portrait orientation.
src/video/uikit/SDL_uikitwindow.m
     1.1 --- a/src/video/uikit/SDL_uikitwindow.m	Sat Aug 12 17:41:59 2017 -0700
     1.2 +++ b/src/video/uikit/SDL_uikitwindow.m	Sat Aug 12 22:16:04 2017 -0300
     1.3 @@ -107,6 +107,14 @@
     1.4  
     1.5  #if !TARGET_OS_TV
     1.6      if (displaydata.uiscreen == [UIScreen mainScreen]) {
     1.7 +        /* SDL_CreateWindow sets the window w&h to the display's bounds if the
     1.8 +         * fullscreen flag is set. But the display bounds orientation might not
     1.9 +         * match what we want, and GetSupportedOrientations call below uses the
    1.10 +         * window w&h. They're overridden below anyway, so we'll just set them
    1.11 +         * to the requested size for the purposes of determining orientation. */
    1.12 +        window->w = window->windowed.w;
    1.13 +        window->h = window->windowed.h;
    1.14 +
    1.15          NSUInteger orients = UIKit_GetSupportedOrientations(window);
    1.16          BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0;
    1.17          BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0;