src/video/uikit/SDL_uikitwindow.m
branchiOS-improvements
changeset 9502 933ed557b7c1
parent 9501 574db299498f
child 9505 6fc615dfc93f
equal deleted inserted replaced
9501:574db299498f 9502:933ed557b7c1
    60     /* Fill in the SDL window with the window data */
    60     /* Fill in the SDL window with the window data */
    61     {
    61     {
    62         window->x = 0;
    62         window->x = 0;
    63         window->y = 0;
    63         window->y = 0;
    64 
    64 
    65         CGRect bounds;
    65         CGRect frame = UIKit_ComputeViewFrame(window, displaydata->uiscreen);
    66         if (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) {
       
    67             bounds = [displaydata->uiscreen bounds];
       
    68         } else {
       
    69             bounds = [displaydata->uiscreen applicationFrame];
       
    70         }
       
    71 
    66 
    72         /* Get frame dimensions */
    67         /* Get frame dimensions */
    73         int width = (int) bounds.size.width;
    68         int width = (int) frame.size.width;
    74         int height = (int) bounds.size.height;
    69         int height = (int) frame.size.height;
    75 
    70 
    76         /* Make sure the width/height are oriented correctly */
    71         /* Make sure the width/height are oriented correctly */
    77         if (UIKit_IsDisplayLandscape(displaydata->uiscreen) != (width > height)) {
    72         if (UIKit_IsDisplayLandscape(displaydata->uiscreen) != (width > height)) {
    78             int temp = width;
    73             int temp = width;
    79             width = height;
    74             width = height;
   237 UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
   232 UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
   238 {
   233 {
   239     SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
   234     SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
   240     SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
   235     SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
   241     SDL_uikitviewcontroller *viewcontroller = windowdata->viewcontroller;
   236     SDL_uikitviewcontroller *viewcontroller = windowdata->viewcontroller;
   242     CGRect bounds;
   237     CGRect frame;
   243 
   238 
   244     if (fullscreen || (window->flags & SDL_WINDOW_BORDERLESS)) {
   239     if (fullscreen || (window->flags & SDL_WINDOW_BORDERLESS)) {
   245         [UIApplication sharedApplication].statusBarHidden = YES;
   240         [UIApplication sharedApplication].statusBarHidden = YES;
   246     } else {
   241     } else {
   247         [UIApplication sharedApplication].statusBarHidden = NO;
   242         [UIApplication sharedApplication].statusBarHidden = NO;
   250     /* iOS 7+ won't update the status bar until we tell it to. */
   245     /* iOS 7+ won't update the status bar until we tell it to. */
   251     if ([viewcontroller respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
   246     if ([viewcontroller respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
   252         [viewcontroller setNeedsStatusBarAppearanceUpdate];
   247         [viewcontroller setNeedsStatusBarAppearanceUpdate];
   253     }
   248     }
   254 
   249 
   255     if (fullscreen || (window->flags & SDL_WINDOW_BORDERLESS)) {
       
   256         bounds = [displaydata->uiscreen bounds];
       
   257     } else {
       
   258         bounds = [displaydata->uiscreen applicationFrame];
       
   259     }
       
   260 
       
   261     /* Update the view's frame to account for the status bar change. */
   250     /* Update the view's frame to account for the status bar change. */
   262     windowdata->view.frame = bounds;
   251     frame = UIKit_ComputeViewFrame(window, displaydata->uiscreen);
       
   252     windowdata->view.frame = frame;
   263     [windowdata->view setNeedsLayout];
   253     [windowdata->view setNeedsLayout];
   264     [windowdata->view layoutIfNeeded];
   254     [windowdata->view layoutIfNeeded];
   265 
   255 
   266     /* Get frame dimensions */
   256     /* Get frame dimensions */
   267     int width = (int) bounds.size.width;
   257     int width = (int) frame.size.width;
   268     int height = (int) bounds.size.height;
   258     int height = (int) frame.size.height;
   269 
   259 
   270     /* We can pick either width or height here and we'll rotate the
   260     /* We can pick either width or height here and we'll rotate the
   271        screen to match, so we pick the closest to what we wanted.
   261        screen to match, so we pick the closest to what we wanted.
   272      */
   262      */
   273     if (window->w >= window->h) {
   263     if (window->w >= window->h) {