Skip to content

Conversation

Andersama
Copy link
Contributor

This may not be the correct approach, however this appears to work. The idea is that before modifying CORE.Window.flags when first creating the window we keep a copy of the flags in order to call SetWindowState after initialization has completed, which should behave as if MaximizeWindow or MinimizeWindow, or conceptually any other flag modifying function were called after InitWindow.

This pull request only performs this for the windows platform, modify as needed in the switch statement at the end for others.

This may not be the correct approach, however this appears to work. The idea is that before modifying `CORE.Window.flags` when first creating the window we keep a copy of the flags in order to call `SetWindowState` after initialization has completed, which should behave as if `MaximizeWindow` or `MinimizeWindow`, or conceptually any other flag modifying function were called after `InitWindow`.

This pull request only performs this for the windows platform, modify as needed in the switch statement at the end for others.
@JeffM2501
Copy link
Contributor

I think you can do this for all the GLFW platforms, not just windows.
I think you should also check the other desktop platforms and see if they need the same fix.

@raysan5
Copy link
Owner

raysan5 commented Mar 14, 2025

@Andersama Sorry, I don't understand the use case of this change... user should know the flags they are modyfying...

@JeffM2501
Copy link
Contributor

@Andersama Sorry, I don't understand the use case of this change... user should know the flags they are modifying

The use case is this.

SetConfigFlags(FLAG_WINDOW_MINIMIZED);
InitWindow(.....);

this does not maximize the window, because InitWindow strips those flags

you must do

InitWindow(.....);
SetWindowState(FLAG_WINDOW_MINIMIZED); // or call MaximizeWindow();

InitPlatform does not support FLAG_WINDOW_MINIMIZED, so even if you set a flag, it gets cleared with no indication it does not work. This leaves the window in a confusing state where a flag was requested but was ignored.

The idea was to have the internal platform call SetWindowState() after the window is initialized by the platform so that it can apply any of the flags that the window initialization can't or doesn't support.

That way when you set these flags at config time, they are actually applied and not ignored silently.

@Andersama
Copy link
Contributor Author

Andersama commented Mar 20, 2025

@raysan5 @JeffM2501's summary pretty much covers it. The only thought I had about doing this was that since this is mostly do to with opening a window, the code could be move to the calling function instead*, which I think would make more sense. But I think its inside this call that most of the work for opening a window is happening anyway so that's where I made the modification.

Also, I wasn't sure if there were other reasons why these flags were ignored in this way.

@JeffM2501 unfortunately I don't have a setup where I can test other operating systems. So I limited the change to the platform I'm confident works.

@raysan5 raysan5 merged commit 195b968 into raysan5:master Aug 12, 2025
@raysan5
Copy link
Owner

raysan5 commented Aug 12, 2025

@JeffM2501 @Andersama thanks for the explanation, I see the use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants