Skip to content

Commit

Permalink
Removed an ugly hack to make windows rotate properly on iOS 8+.
Browse files Browse the repository at this point in the history
Recent commits apparently resolved the issue that made the hack necessary.
  • Loading branch information
slime73 committed Nov 24, 2014
1 parent 9b8a176 commit 6df55c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
6 changes: 1 addition & 5 deletions src/video/uikit/SDL_uikitwindow.h
Expand Up @@ -40,13 +40,9 @@ extern NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window);

@class UIWindow;

@interface SDL_uikitwindow : UIWindow

@end

@interface SDL_WindowData : NSObject

@property (nonatomic, strong) SDL_uikitwindow *uiwindow;
@property (nonatomic, strong) UIWindow *uiwindow;
@property (nonatomic, strong) SDL_uikitopenglview *view;
@property (nonatomic, strong) SDL_uikitviewcontroller *viewcontroller;

Expand Down
19 changes: 2 additions & 17 deletions src/video/uikit/SDL_uikitwindow.m
Expand Up @@ -41,21 +41,6 @@

#include <Foundation/Foundation.h>

@implementation SDL_uikitwindow

- (void)layoutSubviews
{
[super layoutSubviews];

/* This seems to be needed on iOS 8, otherwise the window's frame is put in
* an unexpected position when the screen or device is rotated.
* FIXME: is there a better solution to that problem than this ugly hack?
*/
self.frame = self.screen.bounds;
}

@end

@implementation SDL_WindowData

@synthesize uiwindow;
Expand All @@ -65,7 +50,7 @@ @implementation SDL_WindowData
@end


static int SetupWindowData(_THIS, SDL_Window *window, SDL_uikitwindow *uiwindow, SDL_bool created)
static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created)
{
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *displaydata = (__bridge SDL_DisplayData *) display->driverdata;
Expand Down Expand Up @@ -213,7 +198,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, SDL_uikitwindow *uiwindow,

/* ignore the size user requested, and make a fullscreen window */
/* !!! FIXME: can we have a smaller view? */
SDL_uikitwindow *uiwindow = [[SDL_uikitwindow alloc] initWithFrame:data.uiscreen.bounds];
UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:data.uiscreen.bounds];

/* put the window on an external display if appropriate. This implicitly
* does [uiwindow setframe:[uiscreen bounds]], so don't do it on the
Expand Down

0 comments on commit 6df55c6

Please sign in to comment.