Dynamically removing the border from windows

x7f wrote on Monday, June 16, 2014:

Now glfw3.05 has fixed the problem with negative monitor co-ordinates being returned from glfwGetMonitorPos, I can use the this to determine which monitor my window is running on. In my current implementation, I use a f keypress to toggle between windowed and full screen mode, opening the full screen window on the monitor the user is currently running on as determined above.

However, going to full screen seems like it currently requires me to recreate the window and associated resources. I can get around this by simply resizing the window to fit the display that it running on with I am guessing some performance hit. However, when I do this, I can still see the window border/decoration on the adjacent monitor, so this is not a perfect solution. To make things a little better, I would love to see any/all of the following:

  1. Allow me to remove the border decoration from the window dynamically (possibly using something like setWindowAttribute), or just go full screen without recreating the window (I know this is likely more difficult).
  2. Give me something which can query the size of the window with the decoration on it (removes my guesses on window border size when computing which monitor the window is on with glfwGetMonitorPos) - maybe this already exists?
  3. Provide a getCurrentMonitor(glfwWindow*) call to eliminate the code I am currently using glfwGetWindowPos for.

Thanks for glfw, it is a very handy thing.

arampl wrote on Tuesday, June 17, 2014:

You don’t have to recreate resources (load all textures and models again, for example) when recreating window, if you save OpenGL context before destroying window, then create window which shares this context. Something like this:

glfwCreateWindow(width, height, title, glfwGetPrimaryMonitor(), tmp_window);

Of course, you will need to set callbacks and OpenGL states again.

dougbinks wrote on Tuesday, June 17, 2014:

There’s an open issue on github for fullscreen switching, and a branch in development.