diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5256e086..09dd0fd5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,37 +130,38 @@ if (_GLFW_X11)
list(APPEND glfw_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH})
list(APPEND glfw_LIBRARIES ${X11_X11_LIB})
- # Check for XRandR (modern resolution switching extension)
- if (X11_Xrandr_FOUND)
- set(_GLFW_HAS_XRANDR 1)
- list(APPEND glfw_INCLUDE_DIRS ${X11_Xrandr_INCLUDE_PATH})
- list(APPEND glfw_LIBRARIES ${X11_Xrandr_LIB})
- set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xrandr")
+ # Check for XRandR (modern resolution switching and gamma control)
+ if (NOT X11_Xrandr_FOUND)
+ message(FATAL_ERROR "The RandR extension was not found")
endif()
- # Check for Xf86VidMode (fallback legacy resolution switching extension)
- if (X11_xf86vmode_FOUND)
- set(_GLFW_HAS_XF86VIDMODE 1)
- list(APPEND glfw_INCLUDE_DIRS ${X11_xf86vmode_INCLUDE_PATH})
-
- # NOTE: This is a workaround for CMake bug 0006976 (missing
- # X11_xf86vmode_LIB variable)
- if (X11_xf86vmode_LIB)
- list(APPEND glfw_LIBRARIES ${X11_xf86vmode_LIB})
- else()
- list(APPEND glfw_LIBRARIES Xxf86vm)
- endif()
+ list(APPEND glfw_INCLUDE_DIRS ${X11_Xrandr_INCLUDE_PATH})
+ list(APPEND glfw_LIBRARIES ${X11_Xrandr_LIB})
+ set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xrandr")
- set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xxf86vm")
- endif()
+ # Check for Xf86VidMode (fallback gamma control)
+ if (NOT X11_xf86vmode_FOUND)
+ message(FATAL_ERROR "The Xf86VidMode extension was not found")
+ endif()
+
+ list(APPEND glfw_INCLUDE_DIRS ${X11_xf86vmode_INCLUDE_PATH})
+ set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xxf86vm")
+
+ # NOTE: This is a workaround for CMake bug 0006976 (missing
+ # X11_xf86vmode_LIB variable)
+ if (X11_xf86vmode_LIB)
+ list(APPEND glfw_LIBRARIES ${X11_xf86vmode_LIB})
+ else()
+ list(APPEND glfw_LIBRARIES Xxf86vm)
+ endif()
# Check for Xkb (X keyboard extension)
- if (X11_Xkb_FOUND)
- list(APPEND glfw_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH})
- else()
+ if (NOT X11_Xkb_FOUND)
message(FATAL_ERROR "The X keyboard extension was not found")
endif()
+ list(APPEND glfw_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH})
+
find_library(RT_LIBRARY rt)
mark_as_advanced(RT_LIBRARY)
if (RT_LIBRARY)
diff --git a/readme.html b/readme.html
index ab904d3e..7037378b 100644
--- a/readme.html
+++ b/readme.html
@@ -359,6 +359,7 @@ version of GLFW.
[X11] Added the POSIX CLOCK_MONOTONIC
time source as the preferred method
[X11] Added dependency on libm, where present
[X11] Added support for the _NET_WM_NAME
and _NET_WM_ICON_NAME
EWMH window properties
+ [X11] Made client-side RandR and Xf86VidMode extensions required
[X11] Bugfix: Some window properties required by the ICCCM were not set
[X11] Bugfix: Calling glXCreateContextAttribsARB
with an unavailable OpenGL version caused the application to terminate with a BadMatch
Xlib error
[X11] Bugfix: A synchronization point necessary for jitter-free locked cursor mode was incorrectly removed
diff --git a/src/config.h.in b/src/config.h.in
index ad681b98..b289520b 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -57,11 +57,6 @@
// Define this to 1 to disable dynamic loading of winmm
#cmakedefine _GLFW_NO_DLOAD_WINMM
-// Define this to 1 if XRandR is available
-#cmakedefine _GLFW_HAS_XRANDR
-// Define this to 1 if Xf86VidMode is available
-#cmakedefine _GLFW_HAS_XF86VIDMODE
-
// Define this to 1 if glXGetProcAddress is available
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
// Define this to 1 if glXGetProcAddressARB is available
diff --git a/src/x11_gamma.c b/src/x11_gamma.c
index 9856ace0..d3986f11 100644
--- a/src/x11_gamma.c
+++ b/src/x11_gamma.c
@@ -43,7 +43,6 @@
void _glfwInitGammaRamp(void)
{
-#ifdef _GLFW_HAS_XRANDR
// RandR gamma support is only available with version 1.2 and above
if (_glfw.x11.randr.available &&
(_glfw.x11.randr.versionMajor > 1 ||
@@ -68,9 +67,7 @@ void _glfwInitGammaRamp(void)
XRRFreeScreenResources(rr);
}
-#endif /*_GLFW_HAS_XRANDR*/
-#if defined(_GLFW_HAS_XF86VIDMODE)
if (_glfw.x11.vidmode.available && !_glfw.originalRampSize)
{
// Get the gamma size using XF86VidMode
@@ -78,7 +75,6 @@ void _glfwInitGammaRamp(void)
_glfw.x11.screen,
&_glfw.originalRampSize);
}
-#endif /*_GLFW_HAS_XF86VIDMODE*/
if (_glfw.originalRampSize)
{
@@ -121,7 +117,6 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken)
{
-#if defined (_GLFW_HAS_XRANDR)
size_t size = GLFW_GAMMA_RAMP_SIZE * sizeof(unsigned short);
XRRScreenResources* rr = XRRGetScreenResources(_glfw.x11.display,
@@ -138,18 +133,15 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
XRRFreeGamma(gamma);
XRRFreeScreenResources(rr);
-#endif /*_GLFW_HAS_XRANDR*/
}
else if (_glfw.x11.vidmode.available)
{
-#if defined (_GLFW_HAS_XF86VIDMODE)
XF86VidModeGetGammaRamp(_glfw.x11.display,
_glfw.x11.screen,
GLFW_GAMMA_RAMP_SIZE,
ramp->red,
ramp->green,
ramp->blue);
-#endif /*_GLFW_HAS_XF86VIDMODE*/
}
}
@@ -171,7 +163,6 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken)
{
-#if defined (_GLFW_HAS_XRANDR)
int i;
size_t size = GLFW_GAMMA_RAMP_SIZE * sizeof(unsigned short);
@@ -192,18 +183,15 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
}
XRRFreeScreenResources(rr);
-#endif /*_GLFW_HAS_XRANDR*/
}
else if (_glfw.x11.vidmode.available)
{
-#if defined (_GLFW_HAS_XF86VIDMODE)
XF86VidModeSetGammaRamp(_glfw.x11.display,
_glfw.x11.screen,
GLFW_GAMMA_RAMP_SIZE,
(unsigned short*) ramp->red,
(unsigned short*) ramp->green,
(unsigned short*) ramp->blue);
-#endif /*_GLFW_HAS_XF86VIDMODE*/
}
}
diff --git a/src/x11_init.c b/src/x11_init.c
index ffcb7195..6e9761b5 100644
--- a/src/x11_init.c
+++ b/src/x11_init.c
@@ -483,17 +483,12 @@ static GLboolean initDisplay(void)
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
// Check for XF86VidMode extension
-#ifdef _GLFW_HAS_XF86VIDMODE
_glfw.x11.vidmode.available =
XF86VidModeQueryExtension(_glfw.x11.display,
&_glfw.x11.vidmode.eventBase,
&_glfw.x11.vidmode.errorBase);
-#else
- _glfw.x11.vidmode.available = GL_FALSE;
-#endif /*_GLFW_HAS_XF86VIDMODE*/
// Check for RandR extension
-#ifdef _GLFW_HAS_XRANDR
_glfw.x11.randr.available =
XRRQueryExtension(_glfw.x11.display,
&_glfw.x11.randr.eventBase,
@@ -517,9 +512,6 @@ static GLboolean initDisplay(void)
_glfw.x11.randr.available = GL_FALSE;
}
}
-#else
- _glfw.x11.randr.available = GL_FALSE;
-#endif /*_GLFW_HAS_XRANDR*/
// Check if Xkb is supported on this display
_glfw.x11.xkb.versionMajor = 1;
@@ -681,15 +673,6 @@ const char* _glfwPlatformGetVersionString(void)
#elif defined(_GLFW_EGL)
" EGL"
#endif
-#if defined(_GLFW_HAS_XRANDR)
- " XRandR"
-#endif
-#if defined(_GLFW_HAS_XF86VIDMODE)
- " Xf86VidMode"
-#endif
-#if !defined(_GLFW_HAS_XRANDR) && !defined(_GLFW_HAS_XF86VIDMODE)
- " no-mode-switching-support"
-#endif
#if defined(_GLFW_HAS_GLXGETPROCADDRESS)
" glXGetProcAddress"
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSARB)
diff --git a/src/x11_monitor.c b/src/x11_monitor.c
index 3cee50d6..cf8edb75 100644
--- a/src/x11_monitor.c
+++ b/src/x11_monitor.c
@@ -49,7 +49,6 @@ int _glfwGetClosestVideoMode(_GLFWmonitor* monitor, int* width, int* height)
if (_glfw.x11.randr.available)
{
-#if defined(_GLFW_HAS_XRANDR)
int sizecount, bestsize;
XRRScreenConfiguration* sc;
XRRScreenSize* sizelist;
@@ -85,7 +84,6 @@ int _glfwGetClosestVideoMode(_GLFWmonitor* monitor, int* width, int* height)
if (bestsize != -1)
return bestsize;
-#endif /*_GLFW_HAS_XRANDR*/
}
// Default: Simply use the screen resolution
@@ -104,7 +102,6 @@ void _glfwSetVideoModeMODE(_GLFWmonitor* monitor, int mode)
{
if (_glfw.x11.randr.available)
{
-#if defined(_GLFW_HAS_XRANDR)
XRRScreenConfiguration* sc;
Window root;
@@ -131,7 +128,6 @@ void _glfwSetVideoModeMODE(_GLFWmonitor* monitor, int mode)
CurrentTime);
XRRFreeScreenConfigInfo(sc);
-#endif /*_GLFW_HAS_XRANDR*/
}
}
@@ -163,7 +159,6 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
if (_glfw.x11.randr.available)
{
-#if defined(_GLFW_HAS_XRANDR)
XRRScreenConfiguration* sc;
sc = XRRGetScreenInfo(_glfw.x11.display, _glfw.x11.root);
@@ -176,7 +171,6 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
CurrentTime);
XRRFreeScreenConfigInfo(sc);
-#endif /*_GLFW_HAS_XRANDR*/
}
monitor->x11.modeChanged = GL_FALSE;
@@ -200,7 +194,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* found)
if (_glfw.x11.randr.available)
{
-#if defined (_GLFW_HAS_XRANDR)
int i;
RROutput primary;
XRRScreenResources* sr;
@@ -249,7 +242,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* found)
monitors[*found]->x11.output = oi;
(*found)++;
}
-#endif /*_GLFW_HAS_XRANDR*/
}
else
{
@@ -284,11 +276,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* found)
void _glfwPlatformDestroyMonitor(_GLFWmonitor* monitor)
{
if (_glfw.x11.randr.available)
- {
-#if defined (_GLFW_HAS_XRANDR)
XRRFreeOutputInfo(monitor->x11.output);
-#endif /*_GLFW_HAS_XRANDR*/
- }
}
@@ -310,7 +298,6 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
if (_glfw.x11.randr.available)
{
-#if defined(_GLFW_HAS_XRANDR)
XRRScreenResources* sr;
int i, j, count = monitor->x11.output->nmode;
@@ -363,7 +350,6 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
}
XRRFreeScreenResources(sr);
-#endif /*_GLFW_HAS_XRANDR*/
}
else
{
@@ -395,7 +381,6 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
{
if (_glfw.x11.randr.available)
{
-#if defined (_GLFW_HAS_XRANDR)
XRRScreenResources* sr;
XRRCrtcInfo* ci;
@@ -422,7 +407,6 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
XRRFreeCrtcInfo(ci);
XRRFreeScreenResources(sr);
-#endif /*_GLFW_HAS_XRANDR*/
}
else
{
diff --git a/src/x11_platform.h b/src/x11_platform.h
index 50bf7b1d..6e660eb7 100644
--- a/src/x11_platform.h
+++ b/src/x11_platform.h
@@ -38,15 +38,11 @@
#include
#include
-// With XFree86, we can use the XF86VidMode extension
-#if defined(_GLFW_HAS_XF86VIDMODE)
- #include
-#endif
+// The Xf86VidMode extension provides fallback gamma control
+#include
// The XRandR extension provides mode setting and gamma control
-#if defined(_GLFW_HAS_XRANDR)
- #include
-#endif
+#include
// The Xkb extension provides improved keyboard support
#include
@@ -207,13 +203,11 @@ typedef struct _GLFWmonitorX11
{
GLboolean modeChanged;
-#if defined(_GLFW_HAS_XRANDR)
XRROutputInfo* output;
SizeID oldSizeID;
int oldWidth;
int oldHeight;
Rotation oldRotation;
-#endif /*_GLFW_HAS_XRANDR*/
} _GLFWmonitorX11;
diff --git a/src/x11_window.c b/src/x11_window.c
index 7fb7747a..f396b252 100644
--- a/src/x11_window.c
+++ b/src/x11_window.c
@@ -816,7 +816,6 @@ static void processEvent(XEvent *event)
default:
{
-#if defined(_GLFW_HAS_XRANDR)
switch (event->type - _glfw.x11.randr.eventBase)
{
case RRScreenChangeNotify:
@@ -826,7 +825,7 @@ static void processEvent(XEvent *event)
break;
}
}
-#endif /*_GLFW_HAS_XRANDR*/
+
break;
}
}