Fixed gamma functions acting on whole desktop.

Fixes #336.
This commit is contained in:
Camilla Berglund 2014-09-12 14:40:17 +02:00
parent 5ca875a7ff
commit 5bbb837635
2 changed files with 4 additions and 12 deletions

View File

@ -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: Context re-creation was not triggered by sRGB hint
- [Win32] Bugfix: Full screen windows were incorrectly sized and placed on some - [Win32] Bugfix: Full screen windows were incorrectly sized and placed on some
systems 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] Added run-time support for systems lacking the XKB extension
- [X11] Made GLX 1.3 the minimum supported version - [X11] Made GLX 1.3 the minimum supported version
- [X11] Replaced `XRRGetScreenResources` with `XRRGetScreenResourcesCurrent` - [X11] Replaced `XRRGetScreenResources` with `XRRGetScreenResourcesCurrent`

View File

@ -290,13 +290,8 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
{ {
HDC dc; HDC dc;
WORD values[768]; WORD values[768];
DISPLAY_DEVICEW display;
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW)); dc = CreateDCW(L"DISPLAY", monitor->win32.name, NULL, NULL);
display.cb = sizeof(DISPLAY_DEVICEW);
EnumDisplayDevicesW(monitor->win32.name, 0, &display, 0);
dc = CreateDCW(L"DISPLAY", display.DeviceString, NULL, NULL);
GetDeviceGammaRamp(dc, values); GetDeviceGammaRamp(dc, values);
DeleteDC(dc); DeleteDC(dc);
@ -311,7 +306,6 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
{ {
HDC dc; HDC dc;
WORD values[768]; WORD values[768];
DISPLAY_DEVICE display;
if (ramp->size != 256) 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 + 256, ramp->green, 256 * sizeof(unsigned short));
memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short)); memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short));
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW)); dc = CreateDCW(L"DISPLAY", monitor->win32.name, NULL, NULL);
display.cb = sizeof(DISPLAY_DEVICEW);
EnumDisplayDevicesW(monitor->win32.name, 0, &display, 0);
dc = CreateDCW(L"DISPLAY", display.DeviceString, NULL, NULL);
SetDeviceGammaRamp(dc, values); SetDeviceGammaRamp(dc, values);
DeleteDC(dc); DeleteDC(dc);
} }