Commit eecf78dc authored by Kees Bakker's avatar Kees Bakker

Do not use UIScreenMode to add a iOS display, always use the boundary

This solves the problem that on iPad you would get 1024x768 instead
of 768x1024 when calling SDL_GetDesktopDisplayMode(0, &mode)
See Apple's doc for UIScreenMode where is says:
"Most developers should never need to use the information provided
 by this class and should simply use the bounds provided by the
 UIScreen object for their drawing space."
parent 8f5d9a49
...@@ -199,23 +199,25 @@ UIKit_VideoInit(_THIS) ...@@ -199,23 +199,25 @@ UIKit_VideoInit(_THIS)
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending) if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
SDL_UIKit_supports_multiple_displays = YES; SDL_UIKit_supports_multiple_displays = YES;
// If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels. // Add the main screen.
// The iPad added both a larger main screen and the ability to use
// external displays.
if (!SDL_UIKit_supports_multiple_displays) {
// Just give 'em the whole main screen.
UIScreen *uiscreen = [UIScreen mainScreen]; UIScreen *uiscreen = [UIScreen mainScreen];
UIScreenMode *uiscreenmode = [uiscreen currentMode]; UIScreenMode *uiscreenmode = [uiscreen currentMode];
const CGSize size = [uiscreen bounds].size; const CGSize size = [uiscreen bounds].size;
UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height); UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
} else {
// If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
// The iPad added both a larger main screen and the ability to use
// external displays. So, add the other displays (screens in UI speak).
if (SDL_UIKit_supports_multiple_displays) {
for (UIScreen *uiscreen in [UIScreen screens]) { for (UIScreen *uiscreen in [UIScreen screens]) {
// the main screen is the first element in the array. // Only add the other screens
if (uiscreen != [UIScreen mainScreen]) {
UIScreenMode *uiscreenmode = [uiscreen currentMode]; UIScreenMode *uiscreenmode = [uiscreen currentMode];
const CGSize size = [[uiscreen currentMode] size]; const CGSize size = [uiscreen bounds].size;
UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height); UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
} }
} }
}
/* We're done! */ /* We're done! */
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment