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,10 +288,7 @@ if (_GLFW_X11)
endif() endif()
# Check for Xf86VidMode (fallback gamma control) # Check for Xf86VidMode (fallback gamma control)
if (NOT X11_xf86vmode_FOUND) if (X11_xf86vmode_FOUND)
message(FATAL_ERROR "The Xf86VidMode library and headers were not found")
endif()
list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}") list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}")
list(APPEND glfw_PKG_DEPS "xxf86vm") list(APPEND glfw_PKG_DEPS "xxf86vm")
@ -302,6 +299,9 @@ if (_GLFW_X11)
list(APPEND glfw_LIBRARIES Xxf86vm) list(APPEND glfw_LIBRARIES Xxf86vm)
endif() endif()
set(_GLFW_HAS_XF86VM TRUE)
endif()
# Check for Xkb (X keyboard extension) # Check for Xkb (X keyboard extension)
if (NOT X11_Xkb_FOUND) if (NOT X11_Xkb_FOUND)
message(FATAL_ERROR "The X keyboard extension headers were not found") message(FATAL_ERROR "The X keyboard extension headers were not found")

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 - [Cocoa] Bugfix: `glfwSetWindowSize` did not change the video mode for full
screen windows screen windows
- [X11] Made XInput2 optional at compile-time - [X11] Made XInput2 optional at compile-time
- [X11] Made Xxf86vm optional at compile-time
## Contact ## Contact

View File

@ -64,6 +64,8 @@
// Define this to 1 if the XInput X11 extension is available // Define this to 1 if the XInput X11 extension is available
#cmakedefine _GLFW_HAS_XINPUT #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 // Define this to 1 if glXGetProcAddress is available
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS #cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
// Define this to 1 if glXGetProcAddressARB is available // Define this to 1 if glXGetProcAddressARB is available

View File

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

View File

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

View File

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