Properly set up default resolutions.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 05 Jul 2011 22:05:56 -0400
changeset 5558dd0f52bf2bfa
parent 5557 c1ed57cbfd66
child 5562 aa0e501baca0
Properly set up default resolutions.

Fixes Bugzilla #1191.

Thanks to Jeremy Jurksztowicz for the fix!
src/video/uikit/SDL_uikitvideo.m
     1.1 --- a/src/video/uikit/SDL_uikitvideo.m	Wed Jun 22 10:33:48 2011 +0000
     1.2 +++ b/src/video/uikit/SDL_uikitvideo.m	Tue Jul 05 22:05:56 2011 -0400
     1.3 @@ -202,7 +202,7 @@
     1.4  
     1.5  
     1.6  static void
     1.7 -UIKit_AddDisplay(UIScreen *uiscreen, int w, int h)
     1.8 +UIKit_AddDisplay(UIScreen *uiscreen, UIScreenMode *uimode, int w, int h)
     1.9  {
    1.10      SDL_VideoDisplay display;
    1.11      SDL_DisplayMode mode;
    1.12 @@ -211,6 +211,9 @@
    1.13      mode.w = w;
    1.14      mode.h = h;
    1.15      mode.refresh_rate = 0;
    1.16 +    
    1.17 +    [uimode retain];
    1.18 +    mode.driverdata = uimode;
    1.19  
    1.20      SDL_zero(display);
    1.21      display.desktop_mode = mode;
    1.22 @@ -238,8 +241,9 @@
    1.23      if (!SDL_UIKit_supports_multiple_displays) {
    1.24          // Just give 'em the whole main screen.
    1.25          UIScreen *uiscreen = [UIScreen mainScreen];
    1.26 +        UIScreenMode *uiscreenmode = [uiscreen currentMode];
    1.27          const CGRect rect = [uiscreen bounds];
    1.28 -        UIKit_AddDisplay(uiscreen, (int)rect.size.width, (int)rect.size.height);
    1.29 +        UIKit_AddDisplay(uiscreen, uiscreenmode, (int)rect.size.width, (int)rect.size.height);
    1.30      } else {
    1.31          const NSArray *screens = [UIScreen screens];
    1.32          const NSUInteger screen_count = [screens count];
    1.33 @@ -247,8 +251,9 @@
    1.34          for (i = 0; i < screen_count; i++) {
    1.35              // the main screen is the first element in the array.
    1.36              UIScreen *uiscreen = (UIScreen *) [screens objectAtIndex:i];
    1.37 +            UIScreenMode *uiscreenmode = [uiscreen currentMode];
    1.38              const CGSize size = [[uiscreen currentMode] size];
    1.39 -            UIKit_AddDisplay(uiscreen, (int) size.width, (int) size.height);
    1.40 +            UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
    1.41          }
    1.42      }
    1.43