Skip to content

Commit 99a9ecf

Browse files
authored
[rcore] Support window flags with initialization issues
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.
1 parent b80250b commit 99a9ecf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/platforms/rcore_desktop_glfw.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,8 @@ int InitPlatform(void)
13511351
// additionally auto iconify restores the hardware resolution of the monitor if the window that loses focus is a fullscreen window
13521352
glfwWindowHint(GLFW_AUTO_ICONIFY, 0);
13531353

1354+
// Keep flags to restore after initialization (for flags not supported on initialization)
1355+
unsigned int originalCoreWindowFlags = CORE.Window.flags;
13541356
// Check window creation flags
13551357
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) CORE.Window.fullscreen = true;
13561358

@@ -1709,7 +1711,10 @@ int InitPlatform(void)
17091711
char *glfwPlatform = "";
17101712
switch (glfwGetPlatform())
17111713
{
1712-
case GLFW_PLATFORM_WIN32: glfwPlatform = "Win32"; break;
1714+
case GLFW_PLATFORM_WIN32:
1715+
glfwPlatform = "Win32";
1716+
SetWindowState(originalCoreWindowFlags);
1717+
break;
17131718
case GLFW_PLATFORM_COCOA: glfwPlatform = "Cocoa"; break;
17141719
case GLFW_PLATFORM_WAYLAND: glfwPlatform = "Wayland"; break;
17151720
case GLFW_PLATFORM_X11: glfwPlatform = "X11"; break;

0 commit comments

Comments
 (0)