Toggling fullscreen on/off cuts off titlebar

Hello All,

I think there is a glitch on 3.4.

I was trying to come up with a way to toggle the window fullscreen vs windowed at runtime. The only way I found out how to do it is using function “glfwSetWindowMonitor()”.

The problem is that this function, sometimes, uses the coordinate [0, 0] to mean the top-left of client-area, and other times it means the top-left of titlebar. When it uses the client area, the titlebar is hidden passed the top of the monitor.

This is the shortest code that will cut off the titlebar.

GLFWmonitor* monitor = glfwGetPrimaryMonitor();|
const GLFWvidmode* mode = glfwGetVideoMode(monitor);|
glfwSetWindowMonitor(mWindow, monitor, 0, 0, 800, 400, mode->refreshRate);
glfwSetWindowMonitor(mWindow, nullptr, 0, 0, 800, 400, mode->refreshRate);

If you create the window maximized, and then make it fullscreen, and then back to non-fullscreen, then the Window’s titlebar will NOT be cut off.

This is happening in Windows 10.

Hi @gamagan,

Welcome to the GLFW forums.

GLFW 3.4 hasn’t been released yet - are you referring to Github master?

In order to display a maximized non-fullscreen window you should normally use glfwMaximizeWindow.

Although you can query the available work area by calling glfwGetMonitorWorkarea this returns the area not occluded by the OS taskbar and does not take into account the size of the window titlebar. So it’s not currently possible to maximize your window without using glfwMaximizeWindow first to get the maximum size you can create, or use a non decorated window.

Yes, I’m using 3.4, because I’m making use of the new Icon #defines.

In another thread, you answered my question. I was saving the width/height but not the position. After saving and restoring the position, this is now working correctly.

Thank you

Glad you managed to fix your issue.

3.4 doesn’t exist, so I’m assuming you mean Github latest. For future it’s a good idea to state that explicitly along with the commit hash if possible (although in this case it didn’t matter).