Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Properly set up default resolutions.

Fixes Bugzilla #1191.

Thanks to Jeremy Jurksztowicz for the fix!
  • Loading branch information
icculus committed Jul 6, 2011
1 parent 25b1d38 commit 861a888446d386f7962c2feb647b482fd6215089
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/video/uikit/SDL_uikitvideo.m
@@ -202,7 +202,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)


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 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
mode.w = w;
mode.h = h;
mode.refresh_rate = 0;

[uimode retain];
mode.driverdata = uimode;

SDL_zero(display);
display.desktop_mode = mode;
@@ -238,17 +241,19 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
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];
NSUInteger i;
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);
}
}

0 comments on commit 861a888

Please sign in to comment.