Use DwmFlush when DWM is enabled.

Use DwmFlush instead of WGL_EXT_swap_control when desktop compositing is
enabled, to avoid the jitter of DWM and WGL vsync fighting.

Fixes #516.
This commit is contained in:
Camilla Berglund
2015-05-21 14:48:11 +02:00
parent 22e9451192
commit 8309e0ecb0
10 changed files with 29 additions and 29 deletions
+6 -9
View File
@@ -565,15 +565,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_DWMCOMPOSITIONCHANGED:
{
if (_glfwIsCompositionEnabled())
{
_GLFWwindow* previous = _glfwPlatformGetCurrentContext();
_glfwPlatformMakeContextCurrent(window);
_glfwPlatformSwapInterval(0);
_glfwPlatformMakeContextCurrent(previous);
}
// TODO: Restore vsync if compositing was disabled
// HACK: Re-apply interval when desktop composition is toggled to
// ensure WGL swap interval is disabled when necessary
_GLFWwindow* previous = _glfwPlatformGetCurrentContext();
_glfwPlatformMakeContextCurrent(window);
_glfwPlatformSwapInterval(window->wgl.interval);
_glfwPlatformMakeContextCurrent(previous);
break;
}