Skip to content

Commit

Permalink
iOS: Fix app orientation when creating a landscape fullscreen window …
Browse files Browse the repository at this point in the history
…with the device currently in portrait orientation.
  • Loading branch information
slime73 committed Aug 13, 2017
1 parent 059d9e4 commit 9be597a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/video/uikit/SDL_uikitwindow.m
Expand Up @@ -107,6 +107,14 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo

#if !TARGET_OS_TV
if (displaydata.uiscreen == [UIScreen mainScreen]) {
/* SDL_CreateWindow sets the window w&h to the display's bounds if the
* fullscreen flag is set. But the display bounds orientation might not
* match what we want, and GetSupportedOrientations call below uses the
* window w&h. They're overridden below anyway, so we'll just set them
* to the requested size for the purposes of determining orientation. */
window->w = window->windowed.w;
window->h = window->windowed.h;

NSUInteger orients = UIKit_GetSupportedOrientations(window);
BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0;
BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0;
Expand Down

0 comments on commit 9be597a

Please sign in to comment.