Browse Source

[rcore][desktop_glfw] Set AUTO_ICONIFY flag to false per default (#4188)

* GLFW AUTO_ICONIFY flag is now set to false per default.

Previously AUTO_ICONIFY was only disabled if the user requested a Fullscreen window from the start. After that it was not possible to change this behavior on the user side anymore, even when changing to a Fullscreen window.

The AUTO_ICONIFY causes problems on macOS. On macOS if the window is minimized because of AUTO_ICONIFY than the only way to restore it is to click on the icon in the dock. In other words when AUTO_ICONIFY is enabled alt/cmd-tabbing through windows does not work correctly. On windows it works even when AUTO_ICONIFY is enabled.

Additionally if a raylib window is in Fullscreen mode on another monitor the AUTO_ICONIFY behavior is a problem because the user might want to window to stay on the monitor even if it loses focus. (problem on all OS's)

AUTO_ICONIFY also restores the monitor hardware resolution if a fullscreen window loses focus.

* Update rcore_desktop_glfw.c

Extra space removed and comments updated with a space at the beginning
pull/4213/head
Dave Green 8 months ago
committed by GitHub
parent
commit
596cc3a645
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      src/platforms/rcore_desktop_glfw.c

+ 5
- 5
src/platforms/rcore_desktop_glfw.c View File

@ -1275,6 +1275,11 @@ int InitPlatform(void)
//glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); // OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
//glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
// Disable GlFW auto iconify behaviour
// Auto Iconify automatically minimizes (iconifies) the window if the window loses focus
// additionally auto iconify restores the hardware resolution of the monitor if the window that loses focus is a fullscreen window
glfwWindowHint(GLFW_AUTO_ICONIFY, 0);
// Check window creation flags
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) CORE.Window.fullscreen = true;
@ -1454,11 +1459,6 @@ 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;

Loading…
Cancel
Save