WinRT window not always honouring fullscreen flag

Hi,

I found that my SDL program will typically be fullscreen when I request it
by setting the flag, but when I install the app via the microsoft store and
run it on standard PCs/Laptops with Windows 10, it will start in windowed
mode instead.

My program will be completely confused by this, because it expects that the
resolution returned from the SDL_GetDisplayModes() call will be the one
being applied when calling SDL_CreateWindow(). I saw in the code of SDL_
winrtvideo.cpp, however, that the full screen call is just a “try” and might
fail.

What is the proper procedure to react on this when programming for WinRT?
Shall I query the created window afterwards to check whether its full screen
or not, to update the width and height values from the window if fullscreen
was not available at that time?

Alternatively, I could do the same thing I do for MacOS and iOS, where I
query the renderer size after creating the renderer, whose dimensions can be
different than the ones from the window if a high DPI window was created.

Would any of this work, and what’s the better choice?

BTW, here’s the link to the app: https://www.microsoft.com/en-us/store/
games/wmelite-engine/9nblggh4wb5z

Regards,

Daniel

hardcoredaniel wrote:

Hi,

I found that my SDL program will typically be fullscreen when I request it by setting the flag, but when I install the app via the microsoft store and run it on standard PCs/Laptops with Windows 10, it will start in windowed mode instead.

My program will be completely confused by this, because it expects that the resolution returned from the SDL_GetDisplayModes() call will be the one being applied when calling SDL_CreateWindow(). I saw in the code of SDL_winrtvideo.cpp, however, that the full screen call is just a “try” and might fail.

What is the proper procedure to react on this when programming for WinRT? Shall I query the created window afterwards to check whether its full screen or not, to update the width and height values from the window if fullscreen was not available at that time?

Alternatively, I could do the same thing I do for MacOS and iOS, where I query the renderer size after creating the renderer, whose dimensions can be different than the ones from the window if a high DPI window was created.

Would any of this work, and what’s the better choice?

UWP is a bit like iOS, possibly Android (which I’m less familiar with), insofar that OS-native window sizes are largely at the mercy of the OS, and user’s actions, rather than in Win32 or OSX, whereby apps are given a greater deal of control. The ability to toggle fullscreen, for example, isn’t always possible in UWP, hence the use of Windows prefixing their ‘go to/from fullscreen’ function with ‘Try’.

What device(s) have you tried this on? The app you listed does appear fullscreen on my main development PC. I’m not exactly sure which cases it would not display fullscreen, usually I see the other way around, whereby an app can’t go to windowed mode, but not in the case you describe.

Either which way, yes, querying either window size, or renderer size, after creating the window + renderer, should be fine. Querying renderer size should give a more accurate, cross-platform reading of available pixels.

– David L.

Hi David,

I was too fast publishing a workaround that I tried, so maybe you did not
see the behaviour anymore. I saw the unexpected behaviour on "normal"
laptops without touch input, after installing the app from the store.
Starting it from within VS did not show this behaviour, but running the App
Certification kit did.

What I did now to assure full screen is to handle the "SDL_WINDOW_SHOWN"
event and repeat the “tryFullscreen” call - which I did not see failing
anymore from that time on. Not sure that this would catch all occurances
though.

I also added some experimental code to my SDL branch, that tries to tell
Windows to remember the fullscreen preference. I added it as hint, not
unconditionally. Please have a look at this commit:


commits/1280cdd22806519a0fad68d3576cb880cf2198ba?at=default

However, I cannot tell whether it will actually make a difference…

Regards,

Daniel

---------- P?vodn? zpr?va ----------
Od: DLudwig
Komu: sdl at lists.libsdl.org
Datum: 12. 6. 2016 22:57:53
P?edm?t: Re: [SDL] WinRT window not always honouring fullscreen flag

"

                      hardcoredaniel wrote:	 

Hi,

I found that my SDL program will typically be fullscreen when I request it
by setting the flag, but when I install the app via the microsoft store and
run it on standard PCs/Laptops with Windows 10, it will start in windowed
mode instead.

My program will be completely confused by this, because it expects that the
resolution returned from the SDL_GetDisplayModes() call will be the one
being applied when calling SDL_CreateWindow(). I saw in the code of SDL_
winrtvideo.cpp, however, that the full screen call is just a “try” and might
fail.

What is the proper procedure to react on this when programming for WinRT?
Shall I query the created window afterwards to check whether its full screen
or not, to update the width and height values from the window if fullscreen
was not available at that time?

Alternatively, I could do the same thing I do for MacOS and iOS, where I
query the renderer size after creating the renderer, whose dimensions can be
different than the ones from the window if a high DPI window was created.

      Would any of this work, and what's the better choice?	 

UWP is a bit like iOS, possibly Android (which I’m less familiar with),
insofar that OS-native window sizes are largely at the mercy of the OS, and
user’s actions, rather than in Win32 or OSX, whereby apps are given a
greater deal of control. The ability to toggle fullscreen, for example, isn’
t always possible in UWP, hence the use of Windows prefixing their ‘go to/
from fullscreen’ function with ‘Try’.

What device(s) have you tried this on? The app you listed does appear
fullscreen on my main development PC. I’m not exactly sure which cases it
would not display fullscreen, usually I see the other way around, whereby an
app can’t go to windowed mode, but not in the case you describe.

Either which way, yes, querying either window size, or renderer size, after
creating the window + renderer, should be fine. Querying renderer size
should give a more accurate, cross-platform reading of available pixels.

– David L._______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org"