We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2661

Summary: [patch] Screen size incorrect when changing orientations and resuming
Product: SDL Reporter: philhassey <phil>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus, phil, sylvain.becker
Version: 2.0.3Keywords: triage-2.0.4
Hardware: iPhone/iPod touch   
OS: iOS (All)   
Attachments: patch for this bug

Description philhassey 2014-07-24 16:49:30 UTC
Steps to Reproduce:
1. Using iOS - with orientation lock off
2. Window created with SDL_WINDOW_RESIZABLE
3. Hold device in Landscape orientation
4. Start App
5. Rotate device to Portrait orientation
6. Press Home button
7. Resume the App

Result:
Screen is in correct portrait orientation, but the screen size is the landscape size (so a large chunk of the screen isn't being displayed.)

Expected:
Screen size should be correct given the orientation.

Workaround:
Rotate the device a couple times to resolve the issue.

Notes:
I tried mucking about in UIKit_IsDisplayLandscape to fix this, and did some stuff like changed it to return UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation]);  Sometimes this seemed to help, but it didn't seem to fix the problem all the time.  Mixing it in locking and unlocking the orientation also seems to impact when this happens.
Comment 1 Sylvain 2014-07-29 09:40:09 UTC
Just wondering could this be same as this bug I got from Apple a while ago:

https://bugzilla.libsdl.org/show_bug.cgi?id=2248

(if so, mark mine as duplicate as I there is not method to reproduce it).
Comment 2 philhassey 2014-07-31 02:45:49 UTC
I tracked down the bug and have created a patch.

The function "SDL_SetWindowSize" was not being called during viewDidLayoutSubviews, so when the app was restored, SDL send out an incorrect SDL_WINDOWEVENT_RESIZED in SDL_UpdateFullscreenMode.

This one line patch corrects this bug.

-Phil
Comment 3 philhassey 2014-07-31 02:46:48 UTC
Created attachment 1799 [details]
patch for this bug
Comment 4 Ryan C. Gordon 2015-02-19 06:32:15 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry
if you got a lot of email from this. This is to help me sort through some bugs
in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4,
though!
Comment 5 Ryan C. Gordon 2015-04-10 02:45:40 UTC
This bug should be fixed by the changes made for Bug #2798. Please reopen if that's not the case.

Thanks!

--ryan.