diff -r 50560ca58f80 src/video/uikit/SDL_uikitviewcontroller.m --- a/src/video/uikit/SDL_uikitviewcontroller.m Mon Oct 24 23:18:53 2011 -0400 +++ b/src/video/uikit/SDL_uikitviewcontroller.m Sat Oct 29 15:06:32 2011 +0200 @@ -28,8 +28,8 @@ #include "SDL_uikitwindow.h" -#import "SDL_uikitviewcontroller.h" - +#include "SDL_uikitviewcontroller.h" +#include "SDL_uikitvideo.h" @implementation SDL_uikitviewcontroller @@ -116,38 +116,17 @@ const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation]; SDL_WindowData *data = self->window->driverdata; UIWindow *uiwindow = data->uiwindow; - UIScreen *uiscreen = [uiwindow screen]; + UIScreen *uiscreen; + if (SDL_UIKit_supports_multiple_displays) + uiscreen = [uiwindow screen]; + else + uiscreen = [UIScreen mainScreen]; const int noborder = self->window->flags & SDL_WINDOW_BORDERLESS; CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame]; - const CGSize size = frame.size; - int w, h; - - switch (toInterfaceOrientation) { - case UIInterfaceOrientationPortrait: - case UIInterfaceOrientationPortraitUpsideDown: - w = (size.width < size.height) ? size.width : size.height; - h = (size.width > size.height) ? size.width : size.height; - break; - - case UIInterfaceOrientationLandscapeLeft: - case UIInterfaceOrientationLandscapeRight: - w = (size.width > size.height) ? size.width : size.height; - h = (size.width < size.height) ? size.width : size.height; - break; - - default: - SDL_assert(0 && "Unexpected interface orientation!"); - return; - } - - frame.size.width = w; - frame.size.height = h; - frame.origin.x = 0; - frame.origin.y = 0; [uiwindow setFrame:frame]; [data->view updateFrame]; - SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h); + SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, frame.size.w, frame.size.h); } @end