mirror of
https://github.com/glfw/glfw.git
synced 2025-10-05 06:06:36 +00:00
Win32: Fixup
This commit is contained in:
parent
7a207da22e
commit
159dfaa7d3
@ -83,20 +83,6 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
const int n = i + 1;
|
const int n = i + 1;
|
||||||
_GLFWfbconfig* u = usableConfigs + usableCount;
|
_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)
|
if (_glfw.wgl.ARB_pixel_format)
|
||||||
{
|
{
|
||||||
@ -168,7 +154,9 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
// Get pixel format attributes through legacy PFDs
|
// Get pixel format attributes through legacy PFDs
|
||||||
|
|
||||||
if (!fbconfig->transparent && DescribePixelFormat(window->context.wgl.dc,
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
|
||||||
|
if (!DescribePixelFormat(window->context.wgl.dc,
|
||||||
n,
|
n,
|
||||||
sizeof(PIXELFORMATDESCRIPTOR),
|
sizeof(PIXELFORMATDESCRIPTOR),
|
||||||
&pfd))
|
&pfd))
|
||||||
|
@ -1056,23 +1056,24 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
IsWindowsVistaOrGreater() &&
|
IsWindowsVistaOrGreater() &&
|
||||||
_glfwIsCompositionEnabledWin32())
|
_glfwIsCompositionEnabledWin32())
|
||||||
{
|
{
|
||||||
|
HRGN region = CreateRectRgn(0, 0, -1, -1);
|
||||||
DWM_BLURBEHIND bb = {0};
|
DWM_BLURBEHIND bb = {0};
|
||||||
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
|
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
|
||||||
bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
|
bb.hRgnBlur = region;
|
||||||
bb.fEnable = TRUE;
|
bb.fEnable = TRUE;
|
||||||
|
|
||||||
if (SUCCEEDED(DwmEnableBlurBehindWindow(window->win32.handle, &bb)))
|
if (SUCCEEDED(DwmEnableBlurBehindWindow(window->win32.handle, &bb)))
|
||||||
{
|
{
|
||||||
// Decorated windows on Windows 8 and later don't repaint the
|
// Decorated windows don't repaint the transparent background
|
||||||
// transparent background leaving a trail behind animations
|
// leaving a trail behind animations
|
||||||
// HACK: Making the window layered with a transparency color key
|
// HACK: Making the window layered with a transparency color key
|
||||||
// seems to fix this. Normally, when specifying
|
// seems to fix this. Normally, when specifying
|
||||||
// a transparency color key to be used when composing the
|
// a transparency color key to be used when composing the
|
||||||
// layered window, all pixels painted by the window in this
|
// layered window, all pixels painted by the window in this
|
||||||
// color will be transparent. That doesn't seem to be the
|
// color will be transparent. That doesn't seem to be the
|
||||||
// case anymore on Windows 8 and later, at least when used
|
// case anymore, at least when used with blur behind window
|
||||||
// with DwmEnableBlurBehindWindow plus negative region.
|
// plus negative region.
|
||||||
if (wndconfig->decorated && IsWindows8OrGreater())
|
if (wndconfig->decorated)
|
||||||
{
|
{
|
||||||
long style = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
|
long style = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
|
||||||
style |= WS_EX_LAYERED;
|
style |= WS_EX_LAYERED;
|
||||||
@ -1085,6 +1086,8 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
RGB(0, 193, 48), 255, LWA_COLORKEY);
|
RGB(0, 193, 48), 255, LWA_COLORKEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeleteObject(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user