src/video/uikit/SDL_uikitwindow.m
branchiOS-improvements
changeset 9528 6915f7db6791
parent 9523 9cbd69cac7ed
child 9529 4bf9830d8153
equal deleted inserted replaced
9527:bbd9326ecacf 9528:6915f7db6791
    39 
    39 
    40 #import "SDL_uikitopenglview.h"
    40 #import "SDL_uikitopenglview.h"
    41 
    41 
    42 #include <Foundation/Foundation.h>
    42 #include <Foundation/Foundation.h>
    43 
    43 
    44 @implementation SDL_uikitwindow
       
    45 
       
    46 - (void)layoutSubviews
       
    47 {
       
    48     [super layoutSubviews];
       
    49 
       
    50     /* This seems to be needed on iOS 8, otherwise the window's frame is put in
       
    51      * an unexpected position when the screen or device is rotated.
       
    52      * FIXME: is there a better solution to that problem than this ugly hack?
       
    53      */
       
    54     self.frame = self.screen.bounds;
       
    55 }
       
    56 
       
    57 @end
       
    58 
       
    59 @implementation SDL_WindowData
    44 @implementation SDL_WindowData
    60 
    45 
    61 @synthesize uiwindow;
    46 @synthesize uiwindow;
    62 @synthesize view;
    47 @synthesize view;
    63 @synthesize viewcontroller;
    48 @synthesize viewcontroller;
    64 
    49 
    65 @end
    50 @end
    66 
    51 
    67 
    52 
    68 static int SetupWindowData(_THIS, SDL_Window *window, SDL_uikitwindow *uiwindow, SDL_bool created)
    53 static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created)
    69 {
    54 {
    70     SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    55     SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    71     SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata;
    56     SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata;
    72 
    57 
    73     /* Allocate the window data */
    58     /* Allocate the window data */
   211             }
   196             }
   212         }
   197         }
   213 
   198 
   214         /* ignore the size user requested, and make a fullscreen window */
   199         /* ignore the size user requested, and make a fullscreen window */
   215         /* !!! FIXME: can we have a smaller view? */
   200         /* !!! FIXME: can we have a smaller view? */
   216         SDL_uikitwindow *uiwindow = [[SDL_uikitwindow alloc] initWithFrame:data.uiscreen.bounds];
   201         UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:data.uiscreen.bounds];
   217 
   202 
   218         /* put the window on an external display if appropriate. This implicitly
   203         /* put the window on an external display if appropriate. This implicitly
   219          * does [uiwindow setframe:[uiscreen bounds]], so don't do it on the
   204          * does [uiwindow setframe:[uiscreen bounds]], so don't do it on the
   220          * main display, where we land by default, as that would eat the
   205          * main display, where we land by default, as that would eat the
   221          * status bar real estate.
   206          * status bar real estate.