I’ve started using
glfwSetWindowMonitor to switch back and forth between windowed and fullscreen, and I realised I don’t actually know how to implement this properly.
Switching from windowed to fullscreen and back again in that order is easy: I just cache the position and size of the window, then restore those values later. If the window is created fullscreen, however, to turn it into a window I need to specify a position, and I don’t know the best way to do that!
I thought 0,0 would be a sensible guess, but since it sets the position of the client area, that guarantees any title bar and frame will be offscreen. Less than ideal. I tried using
glfwGetWindowFrameSize to figure out an offset, but predictably that returns 0 for a fullscreen window.
How do others manage this? I’d love to know!