mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 03:52:01 +00:00
Made client-side RandR and Xf86VidMode required.
This commit is contained in:
parent
747b6d8805
commit
6a4c175816
@ -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)
|
||||
|
@ -359,6 +359,7 @@ version of GLFW.</p>
|
||||
<li>[X11] Added the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</li>
|
||||
<li>[X11] Added dependency on libm, where present</li>
|
||||
<li>[X11] Added support for the <code>_NET_WM_NAME</code> and <code>_NET_WM_ICON_NAME</code> EWMH window properties</li>
|
||||
<li>[X11] Made client-side RandR and Xf86VidMode extensions required</li>
|
||||
<li>[X11] Bugfix: Some window properties required by the ICCCM were not set</li>
|
||||
<li>[X11] Bugfix: Calling <code>glXCreateContextAttribsARB</code> with an unavailable OpenGL version caused the application to terminate with a <code>BadMatch</code> Xlib error</li>
|
||||
<li>[X11] Bugfix: A synchronization point necessary for jitter-free locked cursor mode was incorrectly removed</li>
|
||||
|
@ -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
|
||||
|
@ -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*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -38,15 +38,11 @@
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
// With XFree86, we can use the XF86VidMode extension
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#endif
|
||||
// The Xf86VidMode extension provides fallback gamma control
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
|
||||
// The XRandR extension provides mode setting and gamma control
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
|
||||
// The Xkb extension provides improved keyboard support
|
||||
#include <X11/XKBlib.h>
|
||||
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user