GLFW_FULLSCREEN window attrib (x11)

This commit is contained in:
Mike Interlandi 2025-02-02 17:07:38 -05:00
parent 98019fbe98
commit 618532218e
6 changed files with 37 additions and 0 deletions

View File

@ -1102,6 +1102,7 @@ extern "C" {
* [window hint](@ref GLFW_SCALE_FRAMEBUFFER_hint).
*/
#define GLFW_SCALE_FRAMEBUFFER 0x0002200D
#define GLFW_FULLSCREEN 0x0002200E
/*! @brief Legacy name for compatibility.
*
* This is an alias for the

View File

@ -747,6 +747,7 @@ struct _GLFWplatform
void (*setWindowFloating)(_GLFWwindow*,GLFWbool);
void (*setWindowOpacity)(_GLFWwindow*,float);
void (*setWindowMousePassthrough)(_GLFWwindow*,GLFWbool);
void (*getWindowIsFullscreen) (_GLFWwindow*);
void (*pollEvents)(void);
void (*waitEvents)(void);
void (*waitEventsTimeout)(double);

View File

@ -173,6 +173,10 @@ void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor)
window->monitor = monitor;
}
GLFWbool _glfwWindowGetIsFullscreen(_GLFWwindow* window) {
return _glfwGetIsWindowFullscreenX11(window);
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
@ -900,6 +904,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
return window->focusOnShow;
case GLFW_MOUSE_PASSTHROUGH:
return window->mousePassthrough;
case GLFW_FULLSCREEN:
return _glfwWindowGetIsFullscreen(window);
case GLFW_TRANSPARENT_FRAMEBUFFER:
return _glfw.platform.framebufferTransparent(window);
case GLFW_RESIZABLE:

View File

@ -934,6 +934,7 @@ void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled);
float _glfwGetWindowOpacityX11(_GLFWwindow* window);
void _glfwSetWindowOpacityX11(_GLFWwindow* window, float opacity);
void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled);
GLFWbool _glfwGetIsWindowFullscreenX11(_GLFWwindow* window);
void _glfwSetRawMouseMotionX11(_GLFWwindow *window, GLFWbool enabled);
GLFWbool _glfwRawMouseMotionSupportedX11(void);

View File

@ -26,6 +26,7 @@
//========================================================================
#include "internal.h"
#include <X11/Xlib.h>
#if defined(_GLFW_X11)
@ -2729,6 +2730,27 @@ void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled)
}
}
GLFWbool _glfwGetIsWindowFullscreenX11(_GLFWwindow* window)
{
Atom atom = XInternAtom(_glfw.x11.display, "_NET_WM_STATE_FULLSCREEN", 0);
unsigned char prop[32] = {};
XGetWindowProperty(
_glfw.x11.display,
window->x11.handle,
atom,
0,
1, // 32 bits
0,
NULL,
NULL,
NULL,
NULL,
NULL,
(unsigned char**)&prop
);
}
float _glfwGetWindowOpacityX11(_GLFWwindow* window)
{
float opacity = 1.f;

View File

@ -0,0 +1,6 @@
#include <GLFW/glfw3.h>
#include <stdio.h>
int main() {
glfwGetWindowAttrib();
}