c++x11glfw

How to create a maximized glfw window?


Is this even possible?

I am using the OpenGL version of imgui, and one thing is really annoying me, I can't seem to find a way to create a maximized window for imgui.

if (!glfwInit())
  ...

GLFWwindow *window = glfwCreateWindow(1280, 800, "window name", nullptr, nullptr);

/* Maximize window here, but how? */

I have dissected the glfw code a little bit, and it seems like there is no way to get the native window handle, which would be X11 in my case.

Is there any other way to magically maximize the glfw window after its creation?


Solution

  • I don't think there is any cross-platform function in GLFW to maximize a window but GLFW provides a way to access the native windows. The functions are in a different header and macros are used to indicate the window system, so to make theglfwGetX11Window function available :

    #define GLFW_EXPOSE_NATIVE_X11
    #define GLFW_EXPOSE_NATIVE_GLX
    #include <GLFW/glfw3native.h>