mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 21:56:36 +00:00
add filtering of pixelformat composition for win32 transparent window
This commit is contained in:
parent
5796b966bf
commit
25313317f0
@ -133,6 +133,20 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
|
||||
{
|
||||
const int n = i + 1;
|
||||
_GLFWfbconfig* u = usableConfigs + usableCount;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
if (window->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)
|
||||
{
|
||||
@ -188,11 +202,9 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
|
||||
}
|
||||
else
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
// Get pixel format attributes through legacy PFDs
|
||||
|
||||
if (!DescribePixelFormat(window->context.wgl.dc,
|
||||
if (!window->transparent && !DescribePixelFormat(window->context.wgl.dc,
|
||||
n,
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
&pfd))
|
||||
@ -239,6 +251,13 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
|
||||
u->wgl = n;
|
||||
usableCount++;
|
||||
}
|
||||
// Reiterate the selection loop without looking for transparency supporting
|
||||
// formats if no matching pixelformat for a transparent window were found.
|
||||
if (window->transparent && !usableCount) {
|
||||
window->transparent = GLFW_FALSE;
|
||||
free(usableConfigs);
|
||||
return choosePixelFormat(window, desired, result);
|
||||
}
|
||||
|
||||
if (!usableCount)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user