mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-22 10:18:51 -05:00
Wayland: Fix window opacity on older systems
On systems lacking the EGL_EXT_present_opaque extension, some compositors treat any buffer with an alpha channel as per-pixel transparent. This commit ignores any EGLConfig with an alpha channel if the extension is missing and the window is created with GLFW_TRANSPARENT_FRAMEBUFFER set to false. This is technically not a breaking change since GLFW_ALPHA_BITS is not a hard constraint, but it is still going to inconvenience anyone using the framebuffer alpa channel to store other kinds of data. Related to #1895
This commit is contained in:
parent
c18851f52e
commit
ef6c9d8b4f
|
@ -185,6 +185,7 @@ video tutorials.
|
|||
- pthom
|
||||
- Martin Pulec
|
||||
- Guillaume Racicot
|
||||
- Christian Rauch
|
||||
- Philip Rideout
|
||||
- Eddie Ringle
|
||||
- Max Risuhin
|
||||
|
|
|
@ -315,6 +315,8 @@ information on what to include when reporting a bug.
|
|||
- [Wayland] Added support for key names via xkbcommon
|
||||
- [Wayland] Added support for file path drop events (#2040)
|
||||
- [Wayland] Added support for more human-readable monitor names where available
|
||||
- [Wayland] Disabled alpha channel for opaque windows on systems lacking
|
||||
`EGL_EXT_present_opaque` (#1895)
|
||||
- [Wayland] Removed support for `wl_shell` (#1443)
|
||||
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
||||
- [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled
|
||||
|
|
|
@ -126,6 +126,19 @@ To work around this, call any joystick function before waiting for events, for
|
|||
example by setting a [joystick callback](@ref joystick_event).
|
||||
|
||||
|
||||
@subsubsection wayland_alpha_34 Frambuffer may lack alpha channel on older Wayland systems
|
||||
|
||||
On Wayland, when creating an EGL context on a machine lacking the new
|
||||
`EGL_EXT_present_opaque` extension, the @ref GLFW_ALPHA_BITS window hint will be
|
||||
ignored and the framebuffer will have no alpha channel. This is because some
|
||||
Wayland compositors treat any buffer with an alpha channel as per-pixel
|
||||
transparent.
|
||||
|
||||
If you want a per-pixel transparent window, see the
|
||||
[GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) window
|
||||
hint.
|
||||
|
||||
|
||||
@subsubsection standalone_34 Tests and examples are disabled when built as a subproject
|
||||
|
||||
GLFW now does not build the tests and examples when it is added as
|
||||
|
|
|
@ -173,6 +173,21 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
|||
u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE);
|
||||
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
||||
|
||||
#if defined(_GLFW_WAYLAND)
|
||||
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
|
||||
{
|
||||
// NOTE: The wl_surface opaque region is no guarantee that its buffer
|
||||
// is presented as opaque, if it also has an alpha channel
|
||||
// HACK: If EGL_EXT_present_opaque is unavailable, ignore any config
|
||||
// with an alpha channel to ensure the buffer is opaque
|
||||
if (!_glfw.egl.EXT_present_opaque)
|
||||
{
|
||||
if (!desired->transparent && u->alphaBits > 0)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif // _GLFW_WAYLAND
|
||||
|
||||
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
||||
u->doublebuffer = desired->doublebuffer;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user