Hi there. I’ve got an application that can toggle an (OpenGL) window from windowed to fullscreen mode (windowed when on the primary monitor, fullscreen when on a second monitor). The code seems to work fine, using
glfwSetWindowMonitor() (or alternatively, closing and reopening the window in the new location).
This is on Windows 10. When I initially toggle to move to fullscreen mode, everything is fine, the window takes over the second monitor as desired. When I toggle back, the window reappears (at the correct size and position) on the primary monitor. However, on most runs of the program, the second monitor now appears black; the desktop background doesn’t reappear. And if I toggle the window back to fullscreen on it again, now I don’t see my window, the monitor still remains black. When it’s in this state, the mouse cursor also isn’t visible on the second monitor (it was visible as expected, while the full-screen window was open).
However, on some runs it does work properly, returning to the normal desktop background when the window leaves fullscreen on the second monitor.
When it does get into this strange state, it always returns to normal (so I can see the 2nd display’s desktop) when my program exits. It also can sometimes get back to the correct state during a run, if I open (for example) the Windows Display settings window (without changing anything), or do Ctrl-Alt-Del and then press Esc to close the full-screen menu that appears. (Causes the desktop to get refreshed?)
Has anyone else run into similar behaviour? My windows are using a shared OGL context, if that matters, and my displays have different content scale – that does seems to make a difference; at least it seems to work much more reliably when both are set to 100% vs one of them at 125% and the other at 100%.
As mentioned, I’ve tried moving the window between displays using
glfwSetWindowMonitor(), but (after reading the FAQ, section 2.2) I also tried closing and reopening the window on the proper monitor. Same result – most of the time it doesn’t restore the 2nd display when it leaves, but on some runs of the program (or after Ctrl-Alt-Del and Esc) it does.
Thanks for any suggestions,