From 5bbb837635f74fee27bd5de11eacb6c3ed44b8c5 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 12 Sep 2014 14:40:17 +0200 Subject: [PATCH] Fixed gamma functions acting on whole desktop. Fixes #336. --- README.md | 2 ++ src/win32_monitor.c | 14 ++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 567bca60..8fbcdc81 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,8 @@ GLFW bundles a number of dependencies in the `deps/` directory. - [Win32] Bugfix: Context re-creation was not triggered by sRGB hint - [Win32] Bugfix: Full screen windows were incorrectly sized and placed on some systems + - [Win32] Bugfix: Gamma ramp functions acted on entire desktop instead of the + specified monitor - [X11] Added run-time support for systems lacking the XKB extension - [X11] Made GLX 1.3 the minimum supported version - [X11] Replaced `XRRGetScreenResources` with `XRRGetScreenResourcesCurrent` diff --git a/src/win32_monitor.c b/src/win32_monitor.c index ec16da52..0c052ecb 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -290,13 +290,8 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { HDC dc; WORD values[768]; - DISPLAY_DEVICEW display; - ZeroMemory(&display, sizeof(DISPLAY_DEVICEW)); - display.cb = sizeof(DISPLAY_DEVICEW); - EnumDisplayDevicesW(monitor->win32.name, 0, &display, 0); - - dc = CreateDCW(L"DISPLAY", display.DeviceString, NULL, NULL); + dc = CreateDCW(L"DISPLAY", monitor->win32.name, NULL, NULL); GetDeviceGammaRamp(dc, values); DeleteDC(dc); @@ -311,7 +306,6 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) { HDC dc; WORD values[768]; - DISPLAY_DEVICE display; if (ramp->size != 256) { @@ -324,11 +318,7 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short)); memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short)); - ZeroMemory(&display, sizeof(DISPLAY_DEVICEW)); - display.cb = sizeof(DISPLAY_DEVICEW); - EnumDisplayDevicesW(monitor->win32.name, 0, &display, 0); - - dc = CreateDCW(L"DISPLAY", display.DeviceString, NULL, NULL); + dc = CreateDCW(L"DISPLAY", monitor->win32.name, NULL, NULL); SetDeviceGammaRamp(dc, values); DeleteDC(dc); }