From 6019072eef1fd5c166354dfeb58af15f46bcfa5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 17 Jun 2016 11:23:30 -0400 Subject: [PATCH 1/2] Default to preferring a zero alpha bits window framebuffer At the current state, GLFW doesn't support transparent windows, so lets default to preferring a RGBX style buffer instead of a RGBA style buffer. This fixes an issue in the Wayland backend where GLFW would choose a RGBA buffer but still assume its opaque. --- src/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window.c b/src/window.c index 113ed80f4..ff54da22d 100644 --- a/src/window.c +++ b/src/window.c @@ -252,7 +252,7 @@ void glfwDefaultWindowHints(void) _glfw.hints.framebuffer.redBits = 8; _glfw.hints.framebuffer.greenBits = 8; _glfw.hints.framebuffer.blueBits = 8; - _glfw.hints.framebuffer.alphaBits = 8; + _glfw.hints.framebuffer.alphaBits = 0; _glfw.hints.framebuffer.depthBits = 24; _glfw.hints.framebuffer.stencilBits = 8; _glfw.hints.framebuffer.doublebuffer = GLFW_TRUE; From 9d3eafa1a242fa6f9c9921092ad9c4ed01c2167f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 17 Jun 2016 11:38:13 -0400 Subject: [PATCH 2/2] wayland: Only set the opaque region if we got a opaque buffer If the application set the window ALPHA_BITS hint to > 0, we will choose an RGBA buffer instead of an RGBX buffer, meaning it will not be opaque, and if so, lets not lie to the compositor saying it's opaque. --- src/wl_window.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wl_window.c b/src/wl_window.c index 04cbd997f..0deea6353 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -178,6 +178,12 @@ static const struct wl_surface_listener surfaceListener = { static void setOpaqueRegion(_GLFWwindow* window) { struct wl_region* region; + int alphaBits; + + eglGetConfigAttrib(_glfw.egl.display, window->context.egl.config, + EGL_ALPHA_SIZE, &alphaBits); + if (alphaBits > 0) + return; region = wl_compositor_create_region(_glfw.wl.compositor); if (!region)