diff --git a/README.md b/README.md index fe6a7325..56a42b11 100644 --- a/README.md +++ b/README.md @@ -152,8 +152,8 @@ information on what to include when reporting a bug. functions for accessing X11 primary selection (#894,#1056) - Added headless [OSMesa](http://mesa3d.org/osmesa.html) backend (#850) - Added definition of `GLAPIENTRY` to public header -- Added `GLFW_TRANSPARENT` window hint for enabling window framebuffer - transparency (#197,#663,#715,#723,#1078) +- Added `GLFW_TRANSPARENT_FRAMEBUFFER` window hint for enabling window + framebuffer transparency (#197,#663,#715,#723,#1078) - Added `GLFW_CENTER_CURSOR` window hint for controlling cursor centering (#749,#842) - Added `GLFW_JOYSTICK_HAT_BUTTONS` init hint (#889) diff --git a/docs/compat.dox b/docs/compat.dox index a27f58f3..38024466 100644 --- a/docs/compat.dox +++ b/docs/compat.dox @@ -82,8 +82,8 @@ extension, regular accelerated mouse motion will be used. GLFW uses both the XRender extension and the compositing manager to support transparent window framebuffers. If the running X server does not support this -extension or there is no running compositing manager, the `GLFW_TRANSPARENT` -framebuffer hint will have no effect. +extension or there is no running compositing manager, the +`GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect. @section compat_glx GLX extensions diff --git a/docs/news.dox b/docs/news.dox index 03a9c8dc..f570ec3d 100644 --- a/docs/news.dox +++ b/docs/news.dox @@ -97,8 +97,9 @@ be disabled with the @ref GLFW_JOYSTICK_HAT_BUTTONS init hint. @subsection news_33_transparent Support for transparent window framebuffer GLFW now supports the creation of windows with transparent framebuffers on -systems with desktop compositing enabled with the @ref GLFW_TRANSPARENT window -hint and attribute. Any window decorations will still be opaque. +systems with desktop compositing enabled with the @ref +GLFW_TRANSPARENT_FRAMEBUFFER window hint and attribute. Any window decorations +will still be opaque. @subsection news_33_centercursor Cursor centering window hint diff --git a/docs/window.dox b/docs/window.dox index 3e8c748f..0e37e5e5 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -225,9 +225,9 @@ __GLFW_CENTER_CURSOR__ specifies whether the cursor should be centered over newly created full screen windows. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. This hint is ignored for windowed mode windows. -@anchor GLFW_TRANSPARENT_hint -__GLFW_TRANSPARENT__ specifies whether the window framebuffer will be -transparent. If enabled and supported by the system, the window framebuffer +@anchor GLFW_TRANSPARENT_FRAMEBUFFER_hint +__GLFW_TRANSPARENT_FRAMEBUFFER__ specifies whether the window framebuffer will +be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. @@ -477,7 +477,7 @@ GLFW_AUTO_ICONIFY | `GLFW_TRUE` | `GLFW_TRUE` or `GL GLFW_FLOATING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_MAXIMIZED | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_CENTER_CURSOR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` -GLFW_TRANSPARENT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` +GLFW_TRANSPARENT_FRAMEBUFFER | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_RED_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_GREEN_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_BLUE_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` @@ -1092,21 +1092,24 @@ the window or framebuffer is resized. @subsection window_transparency Window transparency Window framebuffers can be made transparent on a per-pixel per-frame basis with -the [GLFW_TRANSPARENT](@ref GLFW_TRANSPARENT_hint) window hint. +the [GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) +window hint. @code -glfwWindowHint(GLFW_TRANSPARENT, GLFW_TRUE); +glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); @endcode -If supported by the system, the window framebuffer will be composited with the +If supported by the system, the window content area will be composited with the background using the framebuffer per-pixel alpha channel. This requires desktop compositing to be enabled on the system. It does not affect window decorations. You can check whether the window framebuffer was successfully made transparent -with the [GLFW_TRANSPARENT](@ref GLFW_TRANSPARENT_attrib) window attribute. +with the +[GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib) +window attribute. @code -if (glfwGetWindowAttrib(window, GLFW_TRANSPARENT)) +if (glfwGetWindowAttrib(window, GLFW_TRANSPARENT_FRAMEBUFFER)) { // window framebuffer is currently transparent } @@ -1182,10 +1185,11 @@ called topmost or always-on-top. This can be set before creation with the [GLFW_FLOATING](@ref GLFW_FLOATING_hint) window hint or after with @ref glfwSetWindowAttrib. -@anchor GLFW_TRANSPARENT_attrib -__GLFW_TRANSPARENT__ indicates whether the specified window has a transparent -framebuffer, i.e. the window contents is composited with the background using -the window framebuffer alpha channel. See @ref window_transparency for details. +@anchor GLFW_TRANSPARENT_FRAMEBUFFER_attrib +__GLFW_TRANSPARENT_FRAMEBUFFER__ indicates whether the specified window has +a transparent framebuffer, i.e. the window contents is composited with the +background using the window framebuffer alpha channel. See @ref +window_transparency for details. @subsubsection window_attribs_ctx Context related attributes diff --git a/examples/gears.c b/examples/gears.c index f14b300a..467a955b 100644 --- a/examples/gears.c +++ b/examples/gears.c @@ -312,7 +312,7 @@ int main(int argc, char *argv[]) } glfwWindowHint(GLFW_DEPTH_BITS, 16); - glfwWindowHint(GLFW_TRANSPARENT, GLFW_TRUE); + glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); window = glfwCreateWindow( 300, 300, "Gears", NULL, NULL ); if (!window) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index fc7d3cb3..80f67120 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -789,10 +789,11 @@ extern "C" { #define GLFW_CENTER_CURSOR 0x00020009 /*! @brief Window framebuffer transparency hint and attribute * - * Window framebuffer transparency [window hint](@ref GLFW_TRANSPARENT_hint) - * and [window attribute](@ref GLFW_TRANSPARENT_attrib). + * Window framebuffer transparency + * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and + * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib). */ -#define GLFW_TRANSPARENT 0x0002000A +#define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A /*! @brief Framebuffer bit depth hint. * diff --git a/src/window.c b/src/window.c index 30321733..8b927d98 100644 --- a/src/window.c +++ b/src/window.c @@ -316,7 +316,7 @@ GLFWAPI void glfwWindowHint(int hint, int value) case GLFW_DOUBLEBUFFER: _glfw.hints.framebuffer.doublebuffer = value ? GLFW_TRUE : GLFW_FALSE; return; - case GLFW_TRANSPARENT: + case GLFW_TRANSPARENT_FRAMEBUFFER: _glfw.hints.framebuffer.transparent = value ? GLFW_TRUE : GLFW_FALSE; return; case GLFW_SAMPLES: @@ -743,7 +743,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib) return _glfwPlatformWindowVisible(window); case GLFW_MAXIMIZED: return _glfwPlatformWindowMaximized(window); - case GLFW_TRANSPARENT: + case GLFW_TRANSPARENT_FRAMEBUFFER: return _glfwPlatformFramebufferTransparent(window); case GLFW_RESIZABLE: return window->resizable;