Eliminate UIScreenMode parameter from UIKit_AddDisplay
authorKees Bakker <kees@ijzerbout.nl>
Tue, 18 Oct 2011 21:32:54 +0200
changeset 6018fa4a3c1d857b
parent 6015 9ac7135ac3fb
child 6019 3d8b1ada8ad5
Eliminate UIScreenMode parameter from UIKit_AddDisplay
src/video/uikit/SDL_uikitvideo.m
     1.1 --- a/src/video/uikit/SDL_uikitvideo.m	Tue Oct 18 01:11:08 2011 -0400
     1.2 +++ b/src/video/uikit/SDL_uikitvideo.m	Tue Oct 18 21:32:54 2011 +0200
     1.3 @@ -166,7 +166,7 @@
     1.4  
     1.5  
     1.6  static void
     1.7 -UIKit_AddDisplay(UIScreen *uiscreen, UIScreenMode *uimode, int w, int h)
     1.8 +UIKit_AddDisplay(UIScreen *uiscreen, int w, int h)
     1.9  {
    1.10      SDL_VideoDisplay display;
    1.11      SDL_DisplayMode mode;
    1.12 @@ -176,9 +176,14 @@
    1.13      mode.h = h;
    1.14      mode.refresh_rate = 0;
    1.15  
    1.16 -    [uimode retain];  // once for the desktop_mode
    1.17 -    [uimode retain];  // once for the current_mode
    1.18 -    mode.driverdata = uimode;
    1.19 +    // UIScreenMode showed up in 3.2 (the iPad and later). We're
    1.20 +    //  misusing this supports_multiple_displays flag here for that.
    1.21 +    if (!SDL_UIKit_supports_multiple_displays) {
    1.22 +        UIScreenMode *uimode = [uiscreen currentMode];
    1.23 +        [uimode retain];  // once for the desktop_mode
    1.24 +        [uimode retain];  // once for the current_mode
    1.25 +        mode.driverdata = uimode;
    1.26 +    }
    1.27  
    1.28      SDL_zero(display);
    1.29      display.desktop_mode = mode;
    1.30 @@ -202,9 +207,8 @@
    1.31  
    1.32      // Add the main screen.
    1.33      UIScreen *uiscreen = [UIScreen mainScreen];
    1.34 -    UIScreenMode *uiscreenmode = [uiscreen currentMode];
    1.35      const CGSize size = [uiscreen bounds].size;
    1.36 -    UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
    1.37 +    UIKit_AddDisplay(uiscreen, (int)size.width, (int)size.height);
    1.38  
    1.39      // If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
    1.40      //  The iPad added both a larger main screen and the ability to use
    1.41 @@ -213,9 +217,8 @@
    1.42          for (UIScreen *uiscreen in [UIScreen screens]) {
    1.43              // Only add the other screens
    1.44              if (uiscreen != [UIScreen mainScreen]) {
    1.45 -                UIScreenMode *uiscreenmode = [uiscreen currentMode];
    1.46                  const CGSize size = [uiscreen bounds].size;
    1.47 -                UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
    1.48 +                UIKit_AddDisplay(uiscreen, (int)size.width, (int)size.height);
    1.49              }
    1.50          }
    1.51      }