简体   繁体   English

如何创建最大化的glfw窗口?

[英]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. 我使用的是imguiOpenGL版本 ,有一件事确实让我很烦,我似乎找不到找到 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. 我已经剖析了glfw代码,似乎没有办法获取本机窗口句柄,在我的情况下为X11。

Is there any other way to magically maximize the glfw window after its creation? 创建glfw窗口后,还有其他方法可以神奇地最大化它吗?

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. 我认为GLFW中没有任何跨平台功能可以最大化窗口,但是GLFW提供了一种访问本机窗口的方法。 The functions are in a different header and macros are used to indicate the window system, so to make the glfwGetX11Window function available : 这些函数位于不同的标题中,并且宏用于指示窗口系统,因此可以使glfwGetX11Window函数可用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM