|
|
|
@ -30,7 +30,6 @@ |
|
|
|
|
|
|
|
|
|
#include "internal.h" |
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
#include <string.h> |
|
|
|
|
#include <limits.h> |
|
|
|
@ -621,61 +620,6 @@ static GLboolean initDisplay(void) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
|
// Detect gamma ramp support and save original gamma ramp, if available
|
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
|
|
static void initGammaRamp(void) |
|
|
|
|
{ |
|
|
|
|
#ifdef _GLFW_HAS_XRANDR |
|
|
|
|
// RandR gamma support is only available with version 1.2 and above
|
|
|
|
|
if (_glfwLibrary.X11.RandR.available && |
|
|
|
|
(_glfwLibrary.X11.RandR.majorVersion > 1 || |
|
|
|
|
(_glfwLibrary.X11.RandR.majorVersion == 1 && |
|
|
|
|
_glfwLibrary.X11.RandR.minorVersion >= 2))) |
|
|
|
|
{ |
|
|
|
|
// FIXME: Assumes that all monitors have the same size gamma tables
|
|
|
|
|
// This is reasonable as I suspect the that if they did differ, it
|
|
|
|
|
// would imply that setting the gamma size to an arbitary size is
|
|
|
|
|
// possible as well.
|
|
|
|
|
XRRScreenResources* rr = XRRGetScreenResources(_glfwLibrary.X11.display, |
|
|
|
|
_glfwLibrary.X11.root); |
|
|
|
|
|
|
|
|
|
_glfwLibrary.originalRampSize = XRRGetCrtcGammaSize(_glfwLibrary.X11.display, |
|
|
|
|
rr->crtcs[0]); |
|
|
|
|
if (!_glfwLibrary.originalRampSize) |
|
|
|
|
{ |
|
|
|
|
// This is probably Nvidia RandR with broken gamma support
|
|
|
|
|
// Flag it as useless and try Xf86VidMode below, if available
|
|
|
|
|
_glfwLibrary.X11.RandR.gammaBroken = GL_TRUE; |
|
|
|
|
fprintf(stderr, |
|
|
|
|
"Ignoring broken nVidia implementation of RandR 1.2+ gamma\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
XRRFreeScreenResources(rr); |
|
|
|
|
} |
|
|
|
|
#endif /*_GLFW_HAS_XRANDR*/ |
|
|
|
|
|
|
|
|
|
#if defined(_GLFW_HAS_XF86VIDMODE) |
|
|
|
|
if (_glfwLibrary.X11.VidMode.available && |
|
|
|
|
!_glfwLibrary.originalRampSize) |
|
|
|
|
{ |
|
|
|
|
// Get the gamma size using XF86VidMode
|
|
|
|
|
XF86VidModeGetGammaRampSize(_glfwLibrary.X11.display, |
|
|
|
|
_glfwLibrary.X11.screen, |
|
|
|
|
&_glfwLibrary.originalRampSize); |
|
|
|
|
} |
|
|
|
|
#endif /*_GLFW_HAS_XF86VIDMODE*/ |
|
|
|
|
|
|
|
|
|
if (!_glfwLibrary.originalRampSize) |
|
|
|
|
fprintf(stderr, "No supported gamma ramp API found\n"); |
|
|
|
|
|
|
|
|
|
// Save the original gamma ramp
|
|
|
|
|
_glfwPlatformGetGammaRamp(&_glfwLibrary.originalRamp); |
|
|
|
|
_glfwLibrary.currentRamp = _glfwLibrary.originalRamp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
|
// Create a blank cursor (for locked mouse mode)
|
|
|
|
|
//========================================================================
|
|
|
|
@ -739,7 +683,7 @@ int _glfwPlatformInit(void) |
|
|
|
|
if (!initDisplay()) |
|
|
|
|
return GL_FALSE; |
|
|
|
|
|
|
|
|
|
initGammaRamp(); |
|
|
|
|
_glfwInitGammaRamp(); |
|
|
|
|
|
|
|
|
|
initEWMH(); |
|
|
|
|
|
|
|
|
|