Thomas
Thomas

Reputation: 3225

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?

Upvotes: 2

Views: 3112

Answers (3)

Adua
Adua

Reputation: 23

If someone is looking to "Maximize" and not "Full-Screen" the window. Try glfwMaximizeWindow(); instead.

Upvotes: 1

RWolfe
RWolfe

Reputation: 187

for anybody coming across this question now, there is in fact a way to maximize a GLFW window without requiring access to the native window glfwSetWindowAttrib(_Window, GLFW_MAXIMIZED, GLFW_TRUE);.

Upvotes: 4

Leiaz
Leiaz

Reputation: 2917

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>

Upvotes: 2

Related Questions