Is it possible to disable restoring the previous video mode when the fullscreen window loses focus? I’ve noticed that Fortnite does this and I find it very nice. So basically when the user sets the application to 1280x720 (the monitor has a native resolution of 1920x1080) and the window loses focus the resolution of this monitor should stay on 1280x720 until the applications gets terminated.
Thanks for the quick answer but sadly this restores the desktop resolution after tabbing (with alt+tab) out of the fullscreen application. I mean it says “restore the previous video mode” but when I disable it, it still restores the previous video mode.
Could you clarify whether you have two monitors or are ALT-TABBING to an application on the same monitor? If the later GLFW_AUTO_ICONIFY won’t help (as you need to iconify the app in this case), and GLFW doesn’t have a hint for controlling this behaviour as it’s ‘best practice’ to reset the resolution once the window is iconified.
I have two monitors. The behaviour that I want is that if I have a Desktop resolution of 1920x1080 and I start my application fullscreen with 1280x720 is that I want my changed Desktop resolution to stay at 1280x720 if I ALT-TAB or unfocus the window.
Image example: http://puu.sh/ChcLO/b6ddbefb2e.png
The game changes my Desktop resolution and when I ALT-TAB it gives me a smooth experience because it doesn’t change back to my native Desktop resolution (it stays at 1280x720).
The smooth ALT-TAB experience can only be achieved in GLFW when applying the native resolution. I guess there is no way right now to make this happen right?
In my own tests (Windows 10 latest GLFW) setting
glfwWindowHint(GLFW_AUTO_ICONIFY , GLFW_FALSE);
means that ALT+TAB will not cause a fullscreen window to iconify, so it will remain fullscreen at the chosen resolution. Note that this means you can’t ALT+TAB to a window on the same monitor, as it will be hidden under the fullscreen window.
Can I double check with you that you’ve used this setting?
Ok apparently there is some kind of bug with my 240 Hz monitor. It works fine on my secondary monitor (60 Hz) on a dual setup but the main monitor (with the 240 Hz) freezes for some seconds and acts weird (short blackscreen flicker as well).
it might be worth checking whether you have Focus Assist on, as this does some odd things with ALT+TAB:
Ok at least now I know why I get that behaviour. It’s not the Windows 10 bug but the glfwPollEvents function blocks my main loop for 1 to 3 seconds. Do you know why? I made a clear setup with only one window and no callbacks and this still happens.
I’m not sure what would cause that other than the Focus Assist issue, or another OS call blocking. If you need a workaround you could put the rendering on another thread (events processing has to stay on the main thread).
There is an events.c test which is useful for looking at event issues, but it doesn’t run in fullscreen so you’d need to alter it to take a look at what’s going on, or you could try using Visual Studio profiling to see if that shows anything.