[Win32, GLFW3] Help to remove the white top margin on Win32 window

So if you're using GLFW 3.3.x, you can use the glfwSetWindowAttrib function to replace the native WIN32 functions you're calling. By doing this, you can remove the borders entirely and create a completely borderless window.

#include<GLFW/glfw3.h>

int main(int argc, char** argv)
{
    GLFWwindow* window;
    if (!glfwInit())
    {
        return -1;
    }
    glfwWindowHint(GLFW_DECORATED, false);
    window = glfwCreateWindow(1600, 900, "", NULL, NULL);
    glfwSetWindowAttrib(window, GLFW_DECORATED, GLFW_FALSE);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }
    glfwMakeContextCurrent(window);
    while (!glfwWindowShouldClose(window))
    {
        glClear(GL_COLOR_BUFFER_BIT);
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
    glfwTerminate();
    return 0;
}

The big catch is, while this window should be resizeable, it's not resizeable by the user. You have to use the GLFW commands to reposition the window. In my opinion though, this is probably what you want. "Resizeable but not moveable" is a contradiction of terms: the user would just stretch each margin until the window is where they want it to be. Like, yes, you can tell the OS to make a window that's resizeable but not moveable, but in practical terms there's no reason to make a window like that.

/r/cpp_questions Thread