From 159dfaa7d3a6b3c2bbbf7b91e890a8df9ce18e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 20 Sep 2017 00:58:49 +0200 Subject: [PATCH] Win32: Fixup --- src/wgl_context.c | 18 +++--------------- src/win32_window.c | 15 +++++++++------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/wgl_context.c b/src/wgl_context.c index ba5e816ae..d864a47cc 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -83,20 +83,6 @@ static int choosePixelFormat(_GLFWwindow* window, { const int n = i + 1; _GLFWfbconfig* u = usableConfigs + usableCount; - PIXELFORMATDESCRIPTOR pfd; - - if (fbconfig->transparent) { - if (!DescribePixelFormat(window->context.wgl.dc, - n, - sizeof(PIXELFORMATDESCRIPTOR), - &pfd)) - { - continue; - } - - if (!(pfd.dwFlags & PFD_SUPPORT_COMPOSITION)) - continue; - } if (_glfw.wgl.ARB_pixel_format) { @@ -168,7 +154,9 @@ static int choosePixelFormat(_GLFWwindow* window, { // Get pixel format attributes through legacy PFDs - if (!fbconfig->transparent && DescribePixelFormat(window->context.wgl.dc, + PIXELFORMATDESCRIPTOR pfd; + + if (!DescribePixelFormat(window->context.wgl.dc, n, sizeof(PIXELFORMATDESCRIPTOR), &pfd)) diff --git a/src/win32_window.c b/src/win32_window.c index d52408eef..a6491aee4 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1056,23 +1056,24 @@ static int createNativeWindow(_GLFWwindow* window, IsWindowsVistaOrGreater() && _glfwIsCompositionEnabledWin32()) { + HRGN region = CreateRectRgn(0, 0, -1, -1); DWM_BLURBEHIND bb = {0}; bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; - bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1); + bb.hRgnBlur = region; bb.fEnable = TRUE; if (SUCCEEDED(DwmEnableBlurBehindWindow(window->win32.handle, &bb))) { - // Decorated windows on Windows 8 and later don't repaint the - // transparent background leaving a trail behind animations + // Decorated windows don't repaint the transparent background + // leaving a trail behind animations // HACK: Making the window layered with a transparency color key // seems to fix this. Normally, when specifying // a transparency color key to be used when composing the // layered window, all pixels painted by the window in this // color will be transparent. That doesn't seem to be the - // case anymore on Windows 8 and later, at least when used - // with DwmEnableBlurBehindWindow plus negative region. - if (wndconfig->decorated && IsWindows8OrGreater()) + // case anymore, at least when used with blur behind window + // plus negative region. + if (wndconfig->decorated) { long style = GetWindowLongW(window->win32.handle, GWL_EXSTYLE); style |= WS_EX_LAYERED; @@ -1085,6 +1086,8 @@ static int createNativeWindow(_GLFWwindow* window, RGB(0, 193, 48), 255, LWA_COLORKEY); } } + + DeleteObject(region); } return GLFW_TRUE;