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 4300

Summary: Android : wrong size reported when not in fullscreen.
Product: SDL Reporter: Sylvain <sylvain.becker>
Component: *don't know*Assignee: Sylvain <sylvain.becker>
Status: WAITING --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: someuniquename
Version: don't know   
Hardware: All   
OS: Android (All)   

Description Sylvain 2018-10-07 13:34:36 UTC
Android seems to be hardcoded in fullscreen.

Changeset https://hg.libsdl.org/SDL/rev/6de756c9975a
Get and sends the fullscreen size, whereas the screen is even not currently in fullscreen but with status bar.

Moreover, there is a ugly screen glitch when app starts / goes to background/foreground. Event when it ends ...




A few points:
- In the onCreate() method. It always starts in non-fullscreen.
https://hg.libsdl.org/SDL/file/c4d5e502c1f4/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java#l267

- SDL_WINDOW_RESIZABLE:
Like Mac OS X "SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES" (SDL_hints.h), it dictates fullscreen policy.
SDL_WINDOW_RESIZABLE (or not) offers (or not) the fullscreen.

I think we should keep the resize flag, and remove this line: 
https://hg.libsdl.org/SDL/file/d8683d6ff2f8/src/video/android/SDL_androidwindow.c#l57

- SDL_video.c : 
Maybe also this define is wrong:
https://hg.libsdl.org/SDL/file/c4d5e502c1f4/src/video/SDL_video.c#l1311
Comment 1 Sylvain 2018-10-19 13:38:34 UTC
The glitch when exiting is gone thanks to https://hg.libsdl.org/SDL/rev/85c6aa0836d8

Maybe something similar when going to foreground/background could be done ? do you have that glitch too ?
Comment 2 Sam Lantinga 2019-06-12 15:26:08 UTC
Is this taken care of now, with the other changes you've made?
Comment 3 Sylvain 2019-06-13 08:14:06 UTC
I am not sure ...

With SDL_WINDOW_FULLSCREEN:

I see first:
06-13 09:43:38.548  2781  2781 V SDL     : Window size: 1080x2147
06-13 09:43:38.548  2781  2781 V SDL     : Device size: 1080x2340
Then
06-13 09:43:39.112  2781  2781 V SDL     : Window size: 1080x2265
06-13 09:43:39.112  2781  2781 V SDL     : Device size: 1080x2340

Without SDL_WINDOW_FULLSCREEN:
only one:
06-13 09:56:15.543  4570  4570 V SDL     : Window size: 1080x2147
06-13 09:56:15.543  4570  4570 V SDL     : Device size: 1080x2340



Device Size is the one exposed in DisplayMode.
I usually use it to create the SDL_Window, so I am wrong.

I should in fact use afterwards SDL_GetWindowSize() to get the size of the created window. 
And this is working in non FULLSCREEN.


But in FULLSCREEN (so immersive), I should also always check for RESIZE_EVENT which is problematic to get ,
app are not necessarily designed to respond to a resize of width/heigth (eg be resizeable).
Also the first SDL_GetWindowSize() will return the size of non immersive because it's called early.
Comment 4 Sylvain 2019-06-14 09:11:18 UTC
I think this is now a duplicate of bug 4256