SDL 1.3 SDL_GetDesktopDisplayMode gives 1024x768 instead of 768x1024

Hi,

This problem is still bothering me. Is it just me, using SDL1.3 on iOS?

The problem.
Where would a pixel at the origin, i.e. coordinate (0,0) show up?
(( you hold the ipad in landscape, and the “home” button below ))
In the upper left corner. So, I’d expect the widthXheight to be: 768x1024

See
http://developer.apple.com/library/ios/#DOCUMENTATION/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html

I’m doing this on an iPad
SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(0, &mode);
and I get: width=1024, height=768, huh?
On the simulator, BTW, I get width=768, height=1024

Why do we get 1024x768 on the iPad? Well, because in
UIKit_VideoInit we add screen mode instead of screen
boundary. Have a look at src/video/uikit/SDL_uikitvideo.m

A work-around is to disable “supports multiple displays”. But I
think we need to fix this properly.
– Kees

Hi,

I’ve solved this problem in my SDL at bitbucket. See
https://bitbucket.org/keestux/sdl

The code in src/video/uikit has had a few more changes
then just this bugfix. Most of it is just code cleanup and
refactoring. I did a merge with the main SDL branch
yesterday. To summarize my changes:
summary: Do not use UIScreenMode to add a iOS display, always use
the boundary
summary: Merge upstream updates
summary: Make SDL_uikitviewcontroller.window a real Objective-C
property and synthesize
summary: Minor code cleanup in uikit/SDL_uikitview.m (no functional
changes)
summary: Simplied the code a bit in uikit/SDL_uikitvideo.m
summary: Remove unused SDL_uikitopenglview (privateMethods)
summary: Use Objective-C construct for…in instead of oldfashioned C
(uikit)
summary: Do not exit in (uikit) postFinishLaunch but store the exit
status and use that to return from main()
summary: Cleanup of the use of include files in src/video/uikit
summary: Add Xcode-iPhoneOS/rakefile which can be used to build
SDL.framework from the commandline
summary: Use a consistent source code format in src/video/uikit
summary: Remove INDENT-ON INDENT-OFF comments in src/video/uikit
summary: Cleanup out trailing whitespace in src/video/uikit
– Kees

Op 2011-10-08 14:52 , Kees Bakker schreef:> Hi,

This problem is still bothering me. Is it just me, using SDL1.3 on iOS?

The problem.
Where would a pixel at the origin, i.e. coordinate (0,0) show up?
(( you hold the ipad in landscape, and the “home” button below ))
In the upper left corner. So, I’d expect the widthXheight to be: 768x1024

See
http://developer.apple.com/library/ios/#DOCUMENTATION/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html

I’m doing this on an iPad
SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(0, &mode);
and I get: width=1024, height=768, huh?
On the simulator, BTW, I get width=768, height=1024

Why do we get 1024x768 on the iPad? Well, because in
UIKit_VideoInit we add screen mode instead of screen
boundary. Have a look at src/video/uikit/SDL_uikitvideo.m

A work-around is to disable “supports multiple displays”. But I
think we need to fix this properly.
– Kees


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello, I find your patch quite interesting; just a topic of
discussion, would it be possible to refactor that part so that we can
avoid using UIScreenMode, that is the only API that is forcing a
higher os version? (UIScreenMode is only available since ios 3.2, so
using it on any 3.1.x device will crash any app).

Best,
VittorioOn Sun, Oct 9, 2011 at 10:11 PM, Kees Bakker <kees.bakker at xs4all.nl> wrote:

Hi,

I’ve solved this problem in my SDL at bitbucket. See
? https://bitbucket.org/keestux/sdl

The code in src/video/uikit has had a few more changes
then just this bugfix. Most of it is just code cleanup and
refactoring. I did a merge with the main SDL branch
yesterday. To summarize my changes:
summary: ? ? Do not use UIScreenMode to add a iOS display, always use the
boundary
summary: ? ? Merge upstream updates
summary: ? ? Make SDL_uikitviewcontroller.window a real Objective-C property
and synthesize
summary: ? ? Minor code cleanup in uikit/SDL_uikitview.m (no functional
changes)
summary: ? ? Simplied the code a bit in uikit/SDL_uikitvideo.m
summary: ? ? Remove unused SDL_uikitopenglview (privateMethods)
summary: ? ? Use Objective-C construct for…in instead of oldfashioned C
(uikit)
summary: ? ? Do not exit in (uikit) postFinishLaunch but store the exit
status and use that to return from main()
summary: ? ? Cleanup of the use of include files in src/video/uikit
summary: ? ? Add Xcode-iPhoneOS/rakefile which can be used to build
SDL.framework from the commandline
summary: ? ? Use a consistent source code format in src/video/uikit
summary: ? ? Remove INDENT-ON INDENT-OFF comments in src/video/uikit
summary: ? ? Cleanup out trailing whitespace in src/video/uikit
– Kees

Op 2011-10-08 14:52 , Kees Bakker schreef:

Hi,

This problem is still bothering me. Is it just me, using SDL1.3 on iOS?

The problem.
Where would a pixel at the origin, i.e. coordinate (0,0) show up?
(( you hold the ipad in landscape, and the “home” button below ))
In the upper left corner. So, I’d expect the widthXheight to be: 768x1024

See
http://developer.apple.com/library/ios/#DOCUMENTATION/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html

I’m doing this on an iPad
? ?SDL_DisplayMode mode;
? ?SDL_GetDesktopDisplayMode(0, &mode);
and I get: width=1024, height=768, huh?
On the simulator, BTW, I get width=768, height=1024

Why do we get 1024x768 on the iPad? Well, because in
UIKit_VideoInit we add screen mode instead of screen
boundary. Have a look at src/video/uikit/SDL_uikitvideo.m

A work-around is to disable “supports multiple displays”. But I
think we need to fix this properly.
– Kees


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

OK. I’ll see what I can do. (( I’m in de middle of a iOS app release using
SDL1.3, so things are a bit hectic.))
– Kees

Op 2011-10-11 17:11 , Vittorio G. schreef:> Hello, I find your patch quite interesting; just a topic of

discussion, would it be possible to refactor that part so that we can
avoid using UIScreenMode, that is the only API that is forcing a
higher os version? (UIScreenMode is only available since ios 3.2, so
using it on any 3.1.x device will crash any app).

Best,
Vittorio

On Sun, Oct 9, 2011 at 10:11 PM, Kees Bakker<@Kees_Bakker> wrote:

Hi,

I’ve solved this problem in my SDL at bitbucket. See
https://bitbucket.org/keestux/sdl

The code in src/video/uikit has had a few more changes
then just this bugfix. Most of it is just code cleanup and
refactoring. I did a merge with the main SDL branch
yesterday. To summarize my changes:
summary: Do not use UIScreenMode to add a iOS display, always use the
boundary
summary: Merge upstream updates
summary: Make SDL_uikitviewcontroller.window a real Objective-C property
and synthesize
summary: Minor code cleanup in uikit/SDL_uikitview.m (no functional
changes)
summary: Simplied the code a bit in uikit/SDL_uikitvideo.m
summary: Remove unused SDL_uikitopenglview (privateMethods)
summary: Use Objective-C construct for…in instead of oldfashioned C
(uikit)
summary: Do not exit in (uikit) postFinishLaunch but store the exit
status and use that to return from main()
summary: Cleanup of the use of include files in src/video/uikit
summary: Add Xcode-iPhoneOS/rakefile which can be used to build
SDL.framework from the commandline
summary: Use a consistent source code format in src/video/uikit
summary: Remove INDENT-ON INDENT-OFF comments in src/video/uikit
summary: Cleanup out trailing whitespace in src/video/uikit
– Kees

Op 2011-10-08 14:52 , Kees Bakker schreef:

Hi,

This problem is still bothering me. Is it just me, using SDL1.3 on iOS?

The problem.
Where would a pixel at the origin, i.e. coordinate (0,0) show up?
(( you hold the ipad in landscape, and the “home” button below ))
In the upper left corner. So, I’d expect the widthXheight to be: 768x1024

See
http://developer.apple.com/library/ios/#DOCUMENTATION/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html

I’m doing this on an iPad
SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(0,&mode);
and I get: width=1024, height=768, huh?
On the simulator, BTW, I get width=768, height=1024

Why do we get 1024x768 on the iPad? Well, because in
UIKit_VideoInit we add screen mode instead of screen
boundary. Have a look at src/video/uikit/SDL_uikitvideo.m

A work-around is to disable “supports multiple displays”. But I
think we need to fix this properly.
– Kees


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi Vittorio,

Here is a patch that may work. I haven’t tried to build it
for iOS older than 3.2. It might just fail to build.

What I did was to make sure that no code ever uses UIScreenMode
if systemVersion is older than “3.2”.

My Xcode has only support for iOS 4.2, so I can’t test it. If you
have a chance to test it, that would be great.
– Kees

Op 2011-10-11 17:11 , Vittorio G. schreef:

Hello, I find your patch quite interesting; just a topic of
discussion, would it be possible to refactor that part so that we can
avoid using UIScreenMode, that is the only API that is forcing a
higher os version? (UIScreenMode is only available since ios 3.2, so
using it on any 3.1.x device will crash any app).

Best,
Vittorio

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: donot_use_uiscreenmode_before_ios_32.patch
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20111011/6b7e86a2/attachment.txt

Ok here I am finally testing the fix, maybe a little late, sorry about that!
First of all thanks for submitting your code! While it does a great
job of simplifying the uiscreenmode mess, there is still a little work
to be carried out for true 3.* compatibility. I am attaching a patch
that takes care of the following: in the system version detection, you
should never rely on checking the raw version number, as it can fail
(it failed on my ipod with ios 3.1.3) and apple suggests using the
-respondsToSelector: method rather; secondly I took care of the few
3.2 calls that were left scattered here and there.

Ryan, I’ve also added the patch here:
http://bugzilla.libsdl.org/show_bug.cgi?id=1266 (you can close it when
applied), I’ll so some patch prodding here
http://bugzilla.libsdl.org/show_bug.cgi?id=1239 and I believe that
this one can be closed as well
http://bugzilla.libsdl.org/show_bug.cgi?id=1130 ; please note that the
patch also fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1202

Best,
VittorioOn Tue, Oct 11, 2011 at 9:41 PM, Kees Bakker <kees.bakker at xs4all.nl> wrote:

Hi Vittorio,

Here is a patch that may work. I haven’t tried to build it
for iOS older than 3.2. It might just fail to build.

What I did was to make sure that no code ever uses UIScreenMode
if systemVersion is older than “3.2”.

My Xcode has only support for iOS 4.2, so I can’t test it. If you
have a chance to test it, that would be great.
– Kees

Op 2011-10-11 17:11 , Vittorio G. schreef:

Hello, I find your patch quite interesting; just a topic of
discussion, would it be possible to refactor that part so that we can
avoid using UIScreenMode, that is the only API that is forcing a
higher os version? (UIScreenMode is only available since ios 3.2, so
using it on any 3.1.x device will crash any app).

Best,
Vittorio


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

-------------- next part --------------
A non-text attachment was scrubbed…
Name: ios3compatibility.patch
Type: application/octet-stream
Size: 2460 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20111028/078ebaeb/attachment.obj