src/video/uikit/SDL_uikitwindow.m
branchiOS-improvements
changeset 9502 933ed557b7c1
parent 9501 574db299498f
child 9505 6fc615dfc93f
     1.1 --- a/src/video/uikit/SDL_uikitwindow.m	Wed Jul 23 03:05:31 2014 -0300
     1.2 +++ b/src/video/uikit/SDL_uikitwindow.m	Wed Jul 23 21:55:42 2014 -0300
     1.3 @@ -62,16 +62,11 @@
     1.4          window->x = 0;
     1.5          window->y = 0;
     1.6  
     1.7 -        CGRect bounds;
     1.8 -        if (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) {
     1.9 -            bounds = [displaydata->uiscreen bounds];
    1.10 -        } else {
    1.11 -            bounds = [displaydata->uiscreen applicationFrame];
    1.12 -        }
    1.13 +        CGRect frame = UIKit_ComputeViewFrame(window, displaydata->uiscreen);
    1.14  
    1.15          /* Get frame dimensions */
    1.16 -        int width = (int) bounds.size.width;
    1.17 -        int height = (int) bounds.size.height;
    1.18 +        int width = (int) frame.size.width;
    1.19 +        int height = (int) frame.size.height;
    1.20  
    1.21          /* Make sure the width/height are oriented correctly */
    1.22          if (UIKit_IsDisplayLandscape(displaydata->uiscreen) != (width > height)) {
    1.23 @@ -239,7 +234,7 @@
    1.24      SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
    1.25      SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
    1.26      SDL_uikitviewcontroller *viewcontroller = windowdata->viewcontroller;
    1.27 -    CGRect bounds;
    1.28 +    CGRect frame;
    1.29  
    1.30      if (fullscreen || (window->flags & SDL_WINDOW_BORDERLESS)) {
    1.31          [UIApplication sharedApplication].statusBarHidden = YES;
    1.32 @@ -252,20 +247,15 @@
    1.33          [viewcontroller setNeedsStatusBarAppearanceUpdate];
    1.34      }
    1.35  
    1.36 -    if (fullscreen || (window->flags & SDL_WINDOW_BORDERLESS)) {
    1.37 -        bounds = [displaydata->uiscreen bounds];
    1.38 -    } else {
    1.39 -        bounds = [displaydata->uiscreen applicationFrame];
    1.40 -    }
    1.41 -
    1.42      /* Update the view's frame to account for the status bar change. */
    1.43 -    windowdata->view.frame = bounds;
    1.44 +    frame = UIKit_ComputeViewFrame(window, displaydata->uiscreen);
    1.45 +    windowdata->view.frame = frame;
    1.46      [windowdata->view setNeedsLayout];
    1.47      [windowdata->view layoutIfNeeded];
    1.48  
    1.49      /* Get frame dimensions */
    1.50 -    int width = (int) bounds.size.width;
    1.51 -    int height = (int) bounds.size.height;
    1.52 +    int width = (int) frame.size.width;
    1.53 +    int height = (int) frame.size.height;
    1.54  
    1.55      /* We can pick either width or height here and we'll rotate the
    1.56         screen to match, so we pick the closest to what we wanted.