Made Xxf86vm optional at compile-time.

This commit is contained in:
Camilla Berglund 2015-01-27 23:56:44 +01:00
parent f4c127f75a
commit 5f21e213df
6 changed files with 32 additions and 19 deletions

View File

@ -288,18 +288,18 @@ if (_GLFW_X11)
endif()
# Check for Xf86VidMode (fallback gamma control)
if (NOT X11_xf86vmode_FOUND)
message(FATAL_ERROR "The Xf86VidMode library and headers were not found")
endif()
if (X11_xf86vmode_FOUND)
list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}")
list(APPEND glfw_PKG_DEPS "xxf86vm")
list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}")
list(APPEND glfw_PKG_DEPS "xxf86vm")
if (X11_Xxf86vm_LIB)
list(APPEND glfw_LIBRARIES "${X11_Xxf86vm_LIB}")
else()
# Backwards compatibility (see CMake bug 0006976)
list(APPEND glfw_LIBRARIES Xxf86vm)
endif()
if (X11_Xxf86vm_LIB)
list(APPEND glfw_LIBRARIES "${X11_Xxf86vm_LIB}")
else()
# Backwards compatibility (see CMake bug 0006976)
list(APPEND glfw_LIBRARIES Xxf86vm)
set(_GLFW_HAS_XF86VM TRUE)
endif()
# Check for Xkb (X keyboard extension)

View File

@ -65,6 +65,7 @@ GLFW bundles a number of dependencies in the `deps/` directory.
- [Cocoa] Bugfix: `glfwSetWindowSize` did not change the video mode for full
screen windows
- [X11] Made XInput2 optional at compile-time
- [X11] Made Xxf86vm optional at compile-time
## Contact

View File

@ -64,6 +64,8 @@
// Define this to 1 if the XInput X11 extension is available
#cmakedefine _GLFW_HAS_XINPUT
// Define this to 1 if the Xxf86vm X11 extension is available
#cmakedefine _GLFW_HAS_XF86VM
// Define this to 1 if glXGetProcAddress is available
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
// Define this to 1 if glXGetProcAddressARB is available

View File

@ -479,11 +479,13 @@ static GLboolean initExtensions(void)
"_MOTIF_WM_HINTS",
False);
#if defined(_GLFW_HAS_XF86VM)
// Check for XF86VidMode extension
_glfw.x11.vidmode.available =
XF86VidModeQueryExtension(_glfw.x11.display,
&_glfw.x11.vidmode.eventBase,
&_glfw.x11.vidmode.errorBase);
#endif /*_GLFW_HAS_XF86VM*/
// Check for RandR extension
_glfw.x11.randr.available =

View File

@ -432,6 +432,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
XRRFreeGamma(gamma);
}
#if defined(_GLFW_HAS_XF86VM)
else if (_glfw.x11.vidmode.available)
{
int size;
@ -443,6 +444,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
_glfw.x11.screen,
ramp->size, ramp->red, ramp->green, ramp->blue);
}
#endif /*_GLFW_HAS_XF86VM*/
}
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
@ -458,6 +460,7 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
XRRSetCrtcGamma(_glfw.x11.display, monitor->x11.crtc, gamma);
XRRFreeGamma(gamma);
}
#if defined(_GLFW_HAS_XF86VM)
else if (_glfw.x11.vidmode.available)
{
XF86VidModeSetGammaRamp(_glfw.x11.display,
@ -467,6 +470,7 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
(unsigned short*) ramp->green,
(unsigned short*) ramp->blue);
}
#endif /*_GLFW_HAS_XF86VM*/
}

View File

@ -37,9 +37,6 @@
#include <X11/Xatom.h>
#include <X11/Xcursor/Xcursor.h>
// The Xf86VidMode extension provides fallback gamma control
#include <X11/extensions/xf86vmode.h>
// The XRandR extension provides mode setting and gamma control
#include <X11/extensions/Xrandr.h>
@ -54,6 +51,11 @@
#include <X11/extensions/XInput2.h>
#endif
#if defined(_GLFW_HAS_XF86VM)
// The Xf86VidMode extension provides fallback gamma control
#include <X11/extensions/xf86vmode.h>
#endif
#include "posix_tls.h"
#if defined(_GLFW_GLX)
@ -164,12 +166,6 @@ typedef struct _GLFWlibraryX11
Atom ATOM_PAIR;
Atom GLFW_SELECTION;
struct {
GLboolean available;
int eventBase;
int errorBase;
} vidmode;
struct {
GLboolean available;
int eventBase;
@ -219,6 +215,14 @@ typedef struct _GLFWlibraryX11
} xi;
#endif /*_GLFW_HAS_XINPUT*/
#if defined(_GLFW_HAS_XF86VM)
struct {
GLboolean available;
int eventBase;
int errorBase;
} vidmode;
#endif /*_GLFW_HAS_XF86VM*/
} _GLFWlibraryX11;