Skip to content

Commit

Permalink
disable GLFW_AUTO_ICONIFY for all fullscreen modes
Browse files Browse the repository at this point in the history
If the user requires this feature, they can replicate the behavior on their code side using a simple : `if ( ! IsWindowFocused() ) MinimizeWindow();`
  • Loading branch information
SuperUserNameMan authored Jul 15, 2024
1 parent 32e9d88 commit 312f9c2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/platforms/rcore_desktop_glfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,12 @@ int InitPlatform(void)
// REF: https://github.com/raysan5/raylib/issues/1554
glfwSetJoystickCallback(NULL);

// By default, when a fullscreen window looses focus, GLFW iconifies it and restores the desktop monitor resolution.
// This default behavior can be emulated on user's side with a simple code : `if ( ! IsWindowFocused() ) MinimizeWindow();`
// So we disable this GLFW default behavior and let the user decides by themself the behavior of their program :
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);


GLFWmonitor *monitor = NULL;
if (CORE.Window.fullscreen)
{
Expand Down Expand Up @@ -1484,11 +1490,7 @@ int InitPlatform(void)
// No-fullscreen window creation
bool requestWindowedFullscreen = (CORE.Window.screen.height == 0) && (CORE.Window.screen.width == 0);

// If we are windowed fullscreen, ensures that window does not minimize when focus is lost.
// This hinting code will not work if the user already specified the correct monitor dimensions;
// at this point we don't know the monitor's dimensions. (Though, how did the user then?)
if (requestWindowedFullscreen) glfwWindowHint(GLFW_AUTO_ICONIFY, 0);


// Default to at least one pixel in size, as creation with a zero dimension is not allowed.
int creationWidth = CORE.Window.screen.width != 0 ? CORE.Window.screen.width : 1;
int creationHeight = CORE.Window.screen.height != 0 ? CORE.Window.screen.height : 1;
Expand Down

0 comments on commit 312f9c2

Please sign in to comment.