From 312f9c2cb7df937b4eaf4f0093c1ce12b135c34b Mon Sep 17 00:00:00 2001 From: SuperUserNameMan <9801802+SuperUserNameMan@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:49:02 +0200 Subject: [PATCH] disable `GLFW_AUTO_ICONIFY` for all fullscreen modes If the user requires this feature, they can replicate the behavior on their code side using a simple : `if ( ! IsWindowFocused() ) MinimizeWindow();` --- src/platforms/rcore_desktop_glfw.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 1d15618d3..12204d308 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -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) { @@ -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;