Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Only change the UI orientation if it's actually necessary for the mode.
  • Loading branch information
slouken committed Sep 29, 2012
1 parent ea73f3a commit cc7fbc4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/video/uikit/SDL_uikitvideo.m
Expand Up @@ -357,11 +357,12 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
[data->uiscreen setCurrentMode:modedata->uiscreenmode];

CGSize size = [modedata->uiscreenmode size];
if (size.width >= size.height) {
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
} else {
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
if (mode->w > mode->h) {
if (!UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
} else if (mode->w < mode->h) {
if (!UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
}
}

Expand Down

0 comments on commit cc7fbc4

Please sign in to comment.