This commit is contained in:
Camilla Löwy 2017-08-20 14:41:49 +02:00
parent af866e05d2
commit 0d6937b33b
3 changed files with 14 additions and 14 deletions

View File

@ -233,15 +233,15 @@ static int choosePixelFormat(_GLFWwindow* window,
// //
static GLFWbool isCompositionEnabled(void) static GLFWbool isCompositionEnabled(void)
{ {
BOOL enabled; if (_glfw.win32.dwmapi.instance)
{
BOOL enabled;
if (!_glfw_DwmIsCompositionEnabled) if (DwmIsCompositionEnabled(&enabled) == S_OK)
return FALSE; return enabled;
}
if (_glfw_DwmIsCompositionEnabled(&enabled) != S_OK) return FALSE;
return FALSE;
return enabled;
} }
static void makeContextCurrentWGL(_GLFWwindow* window) static void makeContextCurrentWGL(_GLFWwindow* window)
@ -276,7 +276,7 @@ static void swapBuffersWGL(_GLFWwindow* window)
{ {
int count = abs(window->context.wgl.interval); int count = abs(window->context.wgl.interval);
while (count--) while (count--)
_glfw_DwmFlush(); DwmFlush();
} }
SwapBuffers(window->context.wgl.dc); SwapBuffers(window->context.wgl.dc);

View File

@ -124,9 +124,9 @@ static GLFWbool loadLibraries(void)
_glfw.win32.dwmapi.instance = LoadLibraryA("dwmapi.dll"); _glfw.win32.dwmapi.instance = LoadLibraryA("dwmapi.dll");
if (_glfw.win32.dwmapi.instance) if (_glfw.win32.dwmapi.instance)
{ {
_glfw.win32.dwmapi.DwmIsCompositionEnabled = (PFN_DwmIsCompositionEnabled) _glfw.win32.dwmapi.IsCompositionEnabled = (PFN_DwmIsCompositionEnabled)
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled"); GetProcAddress(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled");
_glfw.win32.dwmapi.DwmFlush = (PFN_DwmFlush) _glfw.win32.dwmapi.Flush = (PFN_DwmFlush)
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush"); GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
} }

View File

@ -180,8 +180,8 @@ typedef BOOL (WINAPI * PFN_ChangeWindowMessageFilterEx)(HWND,UINT,DWORD,PCHANGEF
// dwmapi.dll function pointer typedefs // dwmapi.dll function pointer typedefs
typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*); typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*);
typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID); typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID);
#define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled #define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled
#define _glfw_DwmFlush _glfw.win32.dwmapi.DwmFlush #define DwmFlush _glfw.win32.dwmapi.Flush
// shcore.dll function pointer typedefs // shcore.dll function pointer typedefs
typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS); typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
@ -284,8 +284,8 @@ typedef struct _GLFWlibraryWin32
struct { struct {
HINSTANCE instance; HINSTANCE instance;
PFN_DwmIsCompositionEnabled DwmIsCompositionEnabled; PFN_DwmIsCompositionEnabled IsCompositionEnabled;
PFN_DwmFlush DwmFlush; PFN_DwmFlush Flush;
} dwmapi; } dwmapi;
struct { struct {