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 - Make the Android window creation similar to iOS' window creation
Summary: Make the Android window creation similar to iOS' window creation
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: don't know
Hardware: Other Android (All)
: P2 normal
Assignee: Sylvain
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-11 01:38 UTC by David Serrano
Modified: 2017-08-14 03:56 UTC (History)
1 user (show)

See Also:


Attachments
patch (4.61 KB, patch)
2017-08-13 20:34 UTC, Sylvain
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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