Only change the UI orientation if it's actually necessary for the mode.
authorSam Lantinga
Sat, 29 Sep 2012 16:41:32 -0700
changeset 6516044ce237801a
parent 6515 f750d9ecae1e
child 6517 4a4031308518
Only change the UI orientation if it's actually necessary for the mode.
src/video/uikit/SDL_uikitvideo.m
     1.1 --- a/src/video/uikit/SDL_uikitvideo.m	Sat Sep 29 03:42:40 2012 -0700
     1.2 +++ b/src/video/uikit/SDL_uikitvideo.m	Sat Sep 29 16:41:32 2012 -0700
     1.3 @@ -357,11 +357,12 @@
     1.4          SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
     1.5          [data->uiscreen setCurrentMode:modedata->uiscreenmode];
     1.6  
     1.7 -        CGSize size = [modedata->uiscreenmode size];
     1.8 -        if (size.width >= size.height) {
     1.9 -            [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
    1.10 -        } else {
    1.11 -            [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
    1.12 +        if (mode->w > mode->h) {
    1.13 +            if (!UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
    1.14 +                [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
    1.15 +        } else if (mode->w < mode->h) {
    1.16 +            if (!UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
    1.17 +                [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
    1.18          }
    1.19      }
    1.20