Properly set up default resolutions.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 05 Jul 2011 22:05:56 -0400
changeset 5558 dd0f52bf2bfa
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
--- a/src/video/uikit/SDL_uikitvideo.m	Wed Jun 22 10:33:48 2011 +0000
+++ b/src/video/uikit/SDL_uikitvideo.m	Tue Jul 05 22:05:56 2011 -0400
@@ -202,7 +202,7 @@
 
 
 static void
-UIKit_AddDisplay(UIScreen *uiscreen, int w, int h)
+UIKit_AddDisplay(UIScreen *uiscreen, UIScreenMode *uimode, int w, int h)
 {
     SDL_VideoDisplay display;
     SDL_DisplayMode mode;
@@ -211,6 +211,9 @@
     mode.w = w;
     mode.h = h;
     mode.refresh_rate = 0;
+    
+    [uimode retain];
+    mode.driverdata = uimode;
 
     SDL_zero(display);
     display.desktop_mode = mode;
@@ -238,8 +241,9 @@
     if (!SDL_UIKit_supports_multiple_displays) {
         // Just give 'em the whole main screen.
         UIScreen *uiscreen = [UIScreen mainScreen];
+        UIScreenMode *uiscreenmode = [uiscreen currentMode];
         const CGRect rect = [uiscreen bounds];
-        UIKit_AddDisplay(uiscreen, (int)rect.size.width, (int)rect.size.height);
+        UIKit_AddDisplay(uiscreen, uiscreenmode, (int)rect.size.width, (int)rect.size.height);
     } else {
         const NSArray *screens = [UIScreen screens];
         const NSUInteger screen_count = [screens count];
@@ -247,8 +251,9 @@
         for (i = 0; i < screen_count; i++) {
             // the main screen is the first element in the array.
             UIScreen *uiscreen = (UIScreen *) [screens objectAtIndex:i];
+            UIScreenMode *uiscreenmode = [uiscreen currentMode];
             const CGSize size = [[uiscreen currentMode] size];
-            UIKit_AddDisplay(uiscreen, (int) size.width, (int) size.height);
+            UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
         }
     }