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 3235

Summary: Make the Android window creation similar to iOS' window creation
Product: SDL Reporter: David Serrano <davidantonioserrano66>
Component: videoAssignee: Sylvain <sylvain.becker>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: amaranth72
Version: don't know   
Hardware: Other   
OS: Android (All)   
Attachments: patch

Description David Serrano 2016-01-11 01:38:19 UTC
On iOS sdl will set the orientation based on the width and height of the window. It will also make it auto if the window is resizable. To maintain consistency I think the Android window creation code should do the same.
Comment 1 Alex Szpakowski 2016-01-11 01:58:51 UTC
SDL on iOS also currently respects the SDL_HINT_ORIENTATIONS hint ( https://hg.libsdl.org/SDL/file/b86bef2d4f30/include/SDL_hints.h#l269 ). When that hint is set, its values take precedence over the window's requested aspect ratio and resizable flag.

SDL on Android (and on WinRT I guess too) could match that behaviour to be more consistent.
Comment 2 Sylvain 2017-08-13 20:34:53 UTC
Created attachment 2839 [details]
patch

Here's a patch. 
It tries to get the hint first. Resizable will allow any orientation. Otherwise it uses width/height window.

setOrientation method is splitted in static and non-static, so that it can be overloaded in a user subclass.

Some artefact observed : 
surfaceChanged() can be called twice at the beginning. When the phone starts in portrait and run a landscape application.
Comment 3 Sam Lantinga 2017-08-14 03:56:15 UTC
Patch applied, thanks!
https://hg.libsdl.org/SDL/rev/31ce9a8ce2bd