From 0d6937b33b52935fb9b082bf703d20915147a1d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 20 Aug 2017 14:41:49 +0200 Subject: [PATCH] Cleanup --- src/wgl_context.c | 16 ++++++++-------- src/win32_init.c | 4 ++-- src/win32_platform.h | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/wgl_context.c b/src/wgl_context.c index f209dbf6..1f2b12a5 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -233,15 +233,15 @@ static int choosePixelFormat(_GLFWwindow* window, // static GLFWbool isCompositionEnabled(void) { - BOOL enabled; + if (_glfw.win32.dwmapi.instance) + { + BOOL enabled; - if (!_glfw_DwmIsCompositionEnabled) - return FALSE; + if (DwmIsCompositionEnabled(&enabled) == S_OK) + return enabled; + } - if (_glfw_DwmIsCompositionEnabled(&enabled) != S_OK) - return FALSE; - - return enabled; + return FALSE; } static void makeContextCurrentWGL(_GLFWwindow* window) @@ -276,7 +276,7 @@ static void swapBuffersWGL(_GLFWwindow* window) { int count = abs(window->context.wgl.interval); while (count--) - _glfw_DwmFlush(); + DwmFlush(); } SwapBuffers(window->context.wgl.dc); diff --git a/src/win32_init.c b/src/win32_init.c index 06eb44cb..732ee867 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -124,9 +124,9 @@ static GLFWbool loadLibraries(void) _glfw.win32.dwmapi.instance = LoadLibraryA("dwmapi.dll"); if (_glfw.win32.dwmapi.instance) { - _glfw.win32.dwmapi.DwmIsCompositionEnabled = (PFN_DwmIsCompositionEnabled) + _glfw.win32.dwmapi.IsCompositionEnabled = (PFN_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"); } diff --git a/src/win32_platform.h b/src/win32_platform.h index c21d5ce3..340b1ebb 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -180,8 +180,8 @@ typedef BOOL (WINAPI * PFN_ChangeWindowMessageFilterEx)(HWND,UINT,DWORD,PCHANGEF // dwmapi.dll function pointer typedefs typedef HRESULT (WINAPI * PFN_DwmIsCompositionEnabled)(BOOL*); typedef HRESULT (WINAPI * PFN_DwmFlush)(VOID); -#define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled -#define _glfw_DwmFlush _glfw.win32.dwmapi.DwmFlush +#define DwmIsCompositionEnabled _glfw.win32.dwmapi.IsCompositionEnabled +#define DwmFlush _glfw.win32.dwmapi.Flush // shcore.dll function pointer typedefs typedef HRESULT (WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS); @@ -284,8 +284,8 @@ typedef struct _GLFWlibraryWin32 struct { HINSTANCE instance; - PFN_DwmIsCompositionEnabled DwmIsCompositionEnabled; - PFN_DwmFlush DwmFlush; + PFN_DwmIsCompositionEnabled IsCompositionEnabled; + PFN_DwmFlush Flush; } dwmapi; struct {