window_*_fullscreen() functions break on room change

Reporter: faissaloo  |  Status: open  |  Last Modified: March 08, 2019, 02:51:33 PM

Decided to give xor a compile today.
When in the main game if you hit escape, go to options and enable full screen then go back to the main menu the room will look stretched, if you go to the options here and try to disable fullscreen you will find that you cannot.
This functionality is controlled by the following piece of code:
window_set_fullscreen(not window_get_fullscreen())
JoshDreamland  
This sounds like two bugs. Robert was playing with window scaling not long ago... I thought he'd fixed it. And I thought I fixed window_set_fullscreen on Linux, and then Robert followed suit on Windows.

Does window_set_fullscreen(0) work for you?

Also, what platform? If this is a bug on Linux, it's possible your WM is substituting the atom I'm setting with another one, which would make the get routine fail.

faissaloo  

Calling window_set_fullscreen(0) causes the scaling to go funny and the get routine is still telling me it's fullscreen. I'm on Ubuntu 18.04.
RobertBColton  

I thought I fixed it and the window centering too, but to be honest with you, I was probably just throwing a bucket of water on the forest fire. It's been acting quite funny since we did accept fundies SDL, but I kind of kept my mouth quiet assuming that the elimination of redundant code would eventually improve the situation for all of the platforms. Nobody has just taken up the business of getting them perfect, which is why I've left some of the reported issues open by TKG.
JoshDreamland  

Okay, that's really weird... if window_get_fullscreen is reporting that it's fullscreen, it has the fullscreen atom set on the window. Your window manager should be presenting it in fullscreen... Maybe the remove function is setting it to some null value that I'm not checking for.

I don't understand why scaling the damned view to fit proportionally in a window is so hard. Maybe I'll take a look later; right now, I'm sorting something else.

faissaloo  

It is presenting it in fullscreen, window_set_fullscreen(0) just makes the scaling weird (because it's trying to set the window size), it doesn't stop it from being fullscreen.
RobertBColton  

Putting related issues #1069, #1083, #1084 here so they don't all get lost.
RobertBColton  

@faissaloo The room switching/window code that you specifically are looking for is here:
enigma_user::window_default(true);

RobertBColton  

Alright @faissaloo, sorry it took me so long to try working this issue out, I promise I hadn't forgotten about it. Let me clarify that we have not approved the hack you submitted because I was interested in fixing it the right way for you.

That said, I seem to have fixed the fullscreen toggling for Windows in #1576. Theoretically, I believe it should also fix it for Linux, since it seemingly fixes it for SDL for me too. Let me first say, that the GMS build you have of your game seems to lag a bit when unfullscreening which I guess is just a feature of GMS, but had me thinking it was busted too for a second. Regardless, I would appreciate if you could try out #1576 and let me know how it works for you. Testing your game against #1576 and master seems to demonstrate that this does fix your game's fullscreen toggling for me on Windows.

To break down the issue here, I can simply tell you that the problem is the fact that we are still caching the window dimensions, despite Josh's effort in the past to stop doing that. So when the window goes into fullscreen, the generic enigma::compute_window_size is calling window_set_rectangle which updates the cached window dimensions to cover the entire screen. What we lose is the dimensions of the window prior to being toggled into fullscreen. So my workaround just keeps the cached window dimensions that of the non-fullscreen window while we are in fullscreen mode.

So my plan of attack for fixing this the right way is to discuss what #1576 does with Josh and why it seemingly fixes the problem. I am going to talk to @JoshDreamland about whether he wants to continue caching the window dimensions or not, and what permanent fix to submit.

Please sign in to post comments, or you can view this issue on GitHub.