mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Bypass DwmIsCompositionEnabled checks on Win8+.
DWM composition is always enabled on Win8+, so there's no need to call DwmIsCompositionEnabled on those platforms.
This commit is contained in:
parent
8055dad7e4
commit
1d8424e207
@ -321,10 +321,15 @@ static void swapBuffersWGL(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
if (IsWindowsVistaOrGreater())
|
if (IsWindowsVistaOrGreater())
|
||||||
{
|
{
|
||||||
BOOL enabled;
|
BOOL enabled = FALSE;
|
||||||
|
|
||||||
|
// DWM Composition is always enabled on Win8+
|
||||||
|
if (IsWindows8OrGreater())
|
||||||
|
enabled = TRUE;
|
||||||
|
|
||||||
// HACK: Use DwmFlush when desktop composition is enabled
|
// HACK: Use DwmFlush when desktop composition is enabled
|
||||||
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)
|
if (enabled ||
|
||||||
|
(SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled))
|
||||||
{
|
{
|
||||||
int count = abs(window->context.wgl.interval);
|
int count = abs(window->context.wgl.interval);
|
||||||
while (count--)
|
while (count--)
|
||||||
@ -346,11 +351,16 @@ static void swapIntervalWGL(int interval)
|
|||||||
{
|
{
|
||||||
if (IsWindowsVistaOrGreater())
|
if (IsWindowsVistaOrGreater())
|
||||||
{
|
{
|
||||||
BOOL enabled;
|
BOOL enabled = FALSE;
|
||||||
|
|
||||||
|
// DWM Composition is always enabled on Win8+
|
||||||
|
if (IsWindows8OrGreater())
|
||||||
|
enabled = TRUE;
|
||||||
|
|
||||||
// HACK: Disable WGL swap interval when desktop composition is enabled to
|
// HACK: Disable WGL swap interval when desktop composition is enabled to
|
||||||
// avoid interfering with DWM vsync
|
// avoid interfering with DWM vsync
|
||||||
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)
|
if (enabled ||
|
||||||
|
(SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled))
|
||||||
interval = 0;
|
interval = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user