Win32: Fixup

This commit is contained in:
Camilla Löwy 2017-09-20 00:58:49 +02:00
parent 7a207da22e
commit 159dfaa7d3
2 changed files with 12 additions and 21 deletions

View File

@ -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))

View File

@ -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;