diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 79b06288..5fbaf1b4 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -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 diff --git a/src/internal.h b/src/internal.h index 4f097aa8..320e6724 100644 --- a/src/internal.h +++ b/src/internal.h @@ -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); diff --git a/src/window.c b/src/window.c index e03121a4..140e11b2 100644 --- a/src/window.c +++ b/src/window.c @@ -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: diff --git a/src/x11_platform.h b/src/x11_platform.h index 30326c5b..ac17671f 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -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); diff --git a/src/x11_window.c b/src/x11_window.c index 322349f0..06324faa 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -26,6 +26,7 @@ //======================================================================== #include "internal.h" +#include #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; diff --git a/tests/window_fullscreen_x11.c b/tests/window_fullscreen_x11.c new file mode 100644 index 00000000..8b10036e --- /dev/null +++ b/tests/window_fullscreen_x11.c @@ -0,0 +1,6 @@ +#include +#include + +int main() { + glfwGetWindowAttrib(); +}