Added define guards for XRandR code.

This commit is contained in:
Marcel Metz 2011-10-03 12:48:59 -04:00
parent 426df42d00
commit f89feefa46
3 changed files with 11 additions and 5 deletions

View File

@ -38,6 +38,7 @@
////// GLFW platform API ////// ////// GLFW platform API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#if defined (_GLFW_HAS_XRANDR)
_GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputInfo, XRRCrtcInfo* crtcInfo) _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputInfo, XRRCrtcInfo* crtcInfo)
{ {
*current = _glfwMalloc(sizeof(_GLFWmonitor)); *current = _glfwMalloc(sizeof(_GLFWmonitor));
@ -55,6 +56,7 @@ _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputI
(*current)->X11.output = outputInfo; (*current)->X11.output = outputInfo;
return &((*current)->next); return &((*current)->next);
} }
#endif /*_GLFW_HAS_XRANDR*/
_GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor) _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
{ {
@ -62,7 +64,9 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
result = monitor->next; result = monitor->next;
#if defined (_GLFW_HAS_XRANDR)
XRRFreeOutputInfo(monitor->X11.output); XRRFreeOutputInfo(monitor->X11.output);
#endif /*_GLFW_HAS_XRANDR*/
_glfwFree(monitor); _glfwFree(monitor);
@ -71,8 +75,11 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
void _glfwInitMonitors(void) void _glfwInitMonitors(void)
{ {
_glfwLibrary.monitorListHead = NULL;
if(_glfwLibrary.X11.RandR.available == GL_TRUE) if(_glfwLibrary.X11.RandR.available == GL_TRUE)
{ {
#if defined (_GLFW_HAS_XRANDR)
XRRScreenResources* resources; XRRScreenResources* resources;
int outputIDX; int outputIDX;
_GLFWmonitor** curMonitor; _GLFWmonitor** curMonitor;
@ -113,6 +120,7 @@ void _glfwInitMonitors(void)
XRRFreeCrtcInfo(crtcInfo); XRRFreeCrtcInfo(crtcInfo);
} }
} }
#endif /*_GLFW_HAS_XRANDR*/
} }
} }

View File

@ -353,11 +353,6 @@ int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxco
int viscount, rgbcount, rescount; int viscount, rgbcount, rescount;
int* rgbarray; int* rgbarray;
struct _glfwResolution* resarray; struct _glfwResolution* resarray;
#if defined(_GLFW_HAS_XRANDR)
XRRScreenConfiguration* sc;
XRRScreenSize* sizelist;
int sizecount;
#endif /*_GLFW_HAS_XRANDR*/
#if defined(_GLFW_HAS_XF86VIDMODE) #if defined(_GLFW_HAS_XF86VIDMODE)
XF86VidModeModeInfo** modelist; XF86VidModeModeInfo** modelist;
int modecount, width, height; int modecount, width, height;

View File

@ -250,7 +250,10 @@ GLFWGLOBAL struct {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
typedef struct _GLFWmonitorX11 typedef struct _GLFWmonitorX11
{ {
#if defined(_GLFW_HAS_XRANDR)
XRROutputInfo* output; XRROutputInfo* output;
#endif /*_GLFW_HAS_XRANDR*/
int dummy;
} _GLFWmonitorX11; } _GLFWmonitorX11;