Browse Source

Fixed gamma functions acting on whole desktop.

Fixes #336.
Camilla Berglund 11 years ago
parent
commit
5bbb837635
2 changed files with 4 additions and 12 deletions
  1. 2 0
      README.md
  2. 2 12
      src/win32_monitor.c

+ 2 - 0
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`

+ 2 - 12
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);
 }