Only change the UI orientation if it's actually necessary for the mode.

This commit is contained in:
Sam Lantinga 2012-09-29 16:41:32 -07:00
parent 52780b8ca7
commit 9b357d17de

View file

@ -357,11 +357,12 @@ UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
[data->uiscreen setCurrentMode:modedata->uiscreenmode]; [data->uiscreen setCurrentMode:modedata->uiscreenmode];
CGSize size = [modedata->uiscreenmode size]; if (mode->w > mode->h) {
if (size.width >= size.height) { if (!UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
} else { } else if (mode->w < mode->h) {
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO]; if (!UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
} }
} }