From a0d82754d58ab1a3060ae325f2fd34bcc397ce64 Mon Sep 17 00:00:00 2001 From: Christopher Pelloux Date: Sat, 5 Mar 2016 10:00:12 -0500 Subject: [PATCH] cleanup --- examples/gears.c | 8 -------- src/wgl_context.c | 17 +++++++++++------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/examples/gears.c b/examples/gears.c index 1d64e72ca..bc667ddea 100644 --- a/examples/gears.c +++ b/examples/gears.c @@ -298,17 +298,9 @@ static void init(void) glEnable(GL_NORMALIZE); } -GLFWerrorfun ErrorFun(int i, const char* str) { - char buf[255]; - sprintf(buf, "%d: %s", i, str); - MessageBoxA(0, buf, "Error", MB_ICONERROR | MB_OK); -} - /* program entry */ int main(int argc, char *argv[]) { - glfwSetErrorCallback(ErrorFun); - GLFWwindow* window; int width, height; diff --git a/src/wgl_context.c b/src/wgl_context.c index ec7d952f5..3a9a42b00 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -366,12 +366,14 @@ isWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; } -static GLFWbool isWindows8OrGreater() { +static GLFWbool isWindows8OrGreater() +{ GLFWbool isWin8OrGreater = isWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0) ? GLFW_TRUE: GLFW_FALSE; return isWin8OrGreater; } -static GLFWbool setupTransparentWindow(HWND handle, GLFWbool isDecorated) { +static GLFWbool setupTransparentWindow(_GLFWwindow* window) +{ if (!isCompositionEnabled) { _glfwInputError(GLFW_PLATFORM_ERROR, "WGL: Composition needed for transparent window is disabled"); @@ -383,6 +385,7 @@ static GLFWbool setupTransparentWindow(HWND handle, GLFWbool isDecorated) { } HRESULT hr = S_OK; + HWND handle = window->win32.handle; DWM_BLURBEHIND bb = { 0 }; bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; @@ -403,7 +406,8 @@ static GLFWbool setupTransparentWindow(HWND handle, GLFWbool isDecorated) { // the layered window, all pixels painted by the window in this color will be transparent. // That doesn't seem to be the case anymore on Windows 8+, at least when used with // DwmEnableBlurBehindWindow + negative region. - if (isDecorated && isWindows8OrGreater()) { + if (window->decorated && isWindows8OrGreater()) + { long style = GetWindowLong(handle, GWL_EXSTYLE); if (!style) { _glfwInputError(GLFW_PLATFORM_ERROR, @@ -433,6 +437,7 @@ static GLFWbool setupTransparentWindow(HWND handle, GLFWbool isDecorated) { return GLFW_FALSE; } } + return GLFW_TRUE; } @@ -585,10 +590,10 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, } } - if (window->transparent) { - if (!setupTransparentWindow(window->win32.handle, window->decorated)) { + if (window->transparent) + { + if (!setupTransparentWindow(window)) window->transparent = GLFW_FALSE; - } } return GLFW_TRUE;