mirror of
https://github.com/glfw/glfw.git
synced 2026-09-23 00:59:48 +00:00
Made client-side RandR and Xf86VidMode required.
This commit is contained 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
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
+3
-9
@@ -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;
|
||||
|
||||
|
||||
+1
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user