From f89feefa46eac5b3be0986b9fe2fffe76d11ec20 Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Mon, 3 Oct 2011 12:48:59 -0400 Subject: [PATCH] Added define guards for XRandR code. --- src/x11_display.c | 8 ++++++++ src/x11_fullscreen.c | 5 ----- src/x11_platform.h | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/x11_display.c b/src/x11_display.c index 33db712b..bdc37bb9 100644 --- a/src/x11_display.c +++ b/src/x11_display.c @@ -38,6 +38,7 @@ ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// +#if defined (_GLFW_HAS_XRANDR) _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputInfo, XRRCrtcInfo* crtcInfo) { *current = _glfwMalloc(sizeof(_GLFWmonitor)); @@ -55,6 +56,7 @@ _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputI (*current)->X11.output = outputInfo; return &((*current)->next); } +#endif /*_GLFW_HAS_XRANDR*/ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor) { @@ -62,7 +64,9 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor) result = monitor->next; +#if defined (_GLFW_HAS_XRANDR) XRRFreeOutputInfo(monitor->X11.output); +#endif /*_GLFW_HAS_XRANDR*/ _glfwFree(monitor); @@ -71,8 +75,11 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor) void _glfwInitMonitors(void) { + _glfwLibrary.monitorListHead = NULL; + if(_glfwLibrary.X11.RandR.available == GL_TRUE) { +#if defined (_GLFW_HAS_XRANDR) XRRScreenResources* resources; int outputIDX; _GLFWmonitor** curMonitor; @@ -113,6 +120,7 @@ void _glfwInitMonitors(void) XRRFreeCrtcInfo(crtcInfo); } } +#endif /*_GLFW_HAS_XRANDR*/ } } diff --git a/src/x11_fullscreen.c b/src/x11_fullscreen.c index a31144c6..69c2f624 100644 --- a/src/x11_fullscreen.c +++ b/src/x11_fullscreen.c @@ -353,11 +353,6 @@ int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxco int viscount, rgbcount, rescount; int* rgbarray; struct _glfwResolution* resarray; -#if defined(_GLFW_HAS_XRANDR) - XRRScreenConfiguration* sc; - XRRScreenSize* sizelist; - int sizecount; -#endif /*_GLFW_HAS_XRANDR*/ #if defined(_GLFW_HAS_XF86VIDMODE) XF86VidModeModeInfo** modelist; int modecount, width, height; diff --git a/src/x11_platform.h b/src/x11_platform.h index 7808fde8..461d7436 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -250,7 +250,10 @@ GLFWGLOBAL struct { //------------------------------------------------------------------------ typedef struct _GLFWmonitorX11 { +#if defined(_GLFW_HAS_XRANDR) XRROutputInfo* output; +#endif /*_GLFW_HAS_XRANDR*/ + int dummy; } _GLFWmonitorX11;