Changed: #1034 Use XRender check from FindX11.cmake
This commit is contained in:
parent
5ad7e823e9
commit
697e3a723c
4 changed files with 56 additions and 35 deletions
|
@ -27,7 +27,6 @@ IF(WITH_3D)
|
|||
ELSE(APPLE)
|
||||
FIND_PACKAGE(X11)
|
||||
FIND_PACKAGE(XF86VidMode)
|
||||
FIND_PACKAGE(XRandR)
|
||||
ENDIF(APPLE)
|
||||
ENDIF(NOT WIN32)
|
||||
ENDIF(WITH_DRIVER_OPENGL)
|
||||
|
|
|
@ -2,7 +2,7 @@ FILE(GLOB SRC *.cpp *.h *.def)
|
|||
IF(APPLE)
|
||||
FILE(GLOB MAC_SRC mac/*.h mac/*.m mac/*.mm mac/*.cpp)
|
||||
SET(SRC ${SRC} ${MAC_SRC})
|
||||
SET_SOURCE_FILES_PROPERTIES(${SRC}
|
||||
SET_SOURCE_FILES_PROPERTIES(${SRC}
|
||||
PROPERTIES COMPILE_FLAGS "-x objective-c++")
|
||||
ENDIF(APPLE)
|
||||
|
||||
|
@ -29,25 +29,32 @@ IF(WIN32)
|
|||
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
||||
ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS)
|
||||
ELSE(WIN32)
|
||||
IF(APPLE)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA})
|
||||
ELSE(APPLE)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_X11_LIB})
|
||||
IF(XF86VidMode_FOUND)
|
||||
INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XF86VidMode_LIBRARY})
|
||||
ENDIF(XF86VidMode_FOUND)
|
||||
IF(XRandR_FOUND)
|
||||
INCLUDE_DIRECTORIES(${XRandR_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(${XRandR_DEFINITIONS})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XRandR_LIBRARY})
|
||||
ENDIF(XRandR_FOUND)
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(APPLE)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA})
|
||||
ENDIF(APPLE)
|
||||
|
||||
IF(UNIX AND NOT APPLE)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_X11_LIB})
|
||||
IF(XF86VidMode_FOUND)
|
||||
INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XF86VidMode_LIBRARY})
|
||||
ENDIF(XF86VidMode_FOUND)
|
||||
IF(X11_Xrandr_FOUND)
|
||||
INCLUDE_DIRECTORIES(${X11_Xrandr_INCLUDE_PATH})
|
||||
ADD_DEFINITIONS(-DHAVE_XRANDR)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xrandr_LIB})
|
||||
ENDIF(X11_Xrandr_FOUND)
|
||||
IF(X11_Xrender_FOUND)
|
||||
INCLUDE_DIRECTORIES(${X11_Xrender_INCLUDE_PATH})
|
||||
ADD_DEFINITIONS(-DHAVE_XRENDER)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xrender_LIB})
|
||||
ENDIF(X11_Xrender_FOUND)
|
||||
ENDIF(UNIX AND NOT APPLE)
|
||||
|
||||
IF(NOT APPLE AND WITH_PCH)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp)
|
||||
ENDIF(NOT APPLE AND WITH_PCH)
|
||||
|
|
|
@ -730,10 +730,11 @@ private:
|
|||
XVisualInfo* _visual_info;
|
||||
uint32 _xrandr_version;
|
||||
uint32 _xvidmode_version;
|
||||
uint32 _xrender_version;
|
||||
|
||||
#ifdef XRANDR
|
||||
#ifdef HAVE_XRANDR
|
||||
sint _OldSizeID;
|
||||
#endif // XRANDR
|
||||
#endif // HAVE_XRANDR
|
||||
|
||||
#ifdef XF86VIDMODE
|
||||
sint _OldDotClock; // old dotclock
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
#elif defined (NL_OS_UNIX)
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glx.h>
|
||||
# ifdef XRANDR
|
||||
# ifdef HAVE_XRANDR
|
||||
# include <X11/extensions/Xrandr.h>
|
||||
# endif
|
||||
# endif // HAVE_XRANDR
|
||||
# ifdef HAVE_XRENDER
|
||||
# include <X11/extensions/Xrender.h>
|
||||
# endif // HAVE_XRENDER
|
||||
# include <X11/Xatom.h>
|
||||
# define _NET_WM_STATE_REMOVE 0
|
||||
# define _NET_WM_STATE_ADD 1
|
||||
|
@ -327,7 +330,7 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
|
|||
|
||||
_xrandr_version = 0;
|
||||
|
||||
#ifdef XRANDR
|
||||
#ifdef HAVE_XRANDR
|
||||
_OldSizeID = 0;
|
||||
sint xrandr_major, xrandr_minor;
|
||||
if (XRRQueryVersion(_dpy, &xrandr_major, &xrandr_minor))
|
||||
|
@ -335,8 +338,7 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
|
|||
_xrandr_version = xrandr_major * 100 + xrandr_minor;
|
||||
nlinfo("3D: XRandR %d.%d found", xrandr_major, xrandr_minor);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // HAVE_XRANDR
|
||||
|
||||
_xvidmode_version = 0;
|
||||
|
||||
|
@ -349,7 +351,19 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
|
|||
}
|
||||
#endif
|
||||
|
||||
_xrender_version = 0;
|
||||
|
||||
#ifdef HAVE_XRENDER
|
||||
sint render_major, render_event, render_error;
|
||||
if (XQueryExtension(_dpy, "RENDER", &render_major, &render_event, &render_error))
|
||||
{
|
||||
_xrender_version = render_major * 100;
|
||||
nlinfo("3D: XRender %d.%d found", render_major, 0);
|
||||
}
|
||||
#endif // HAVE_XRENDER
|
||||
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1103,7 +1117,7 @@ bool CDriverGL::saveScreenMode()
|
|||
int screen = DefaultScreen(_dpy);
|
||||
res = false;
|
||||
|
||||
#ifdef XRANDR
|
||||
#ifdef HAVE_XRANDR
|
||||
|
||||
if (!res && _xrandr_version > 0)
|
||||
{
|
||||
|
@ -1124,7 +1138,7 @@ bool CDriverGL::saveScreenMode()
|
|||
}
|
||||
}
|
||||
|
||||
#endif // XRANDR
|
||||
#endif // HAVE_XRANDR
|
||||
|
||||
#if defined(XF86VIDMODE)
|
||||
|
||||
|
@ -1167,7 +1181,7 @@ bool CDriverGL::restoreScreenMode()
|
|||
|
||||
int screen = DefaultScreen(_dpy);
|
||||
|
||||
#ifdef XRANDR
|
||||
#ifdef HAVE_XRANDR
|
||||
|
||||
if (!res && _xrandr_version > 0)
|
||||
{
|
||||
|
@ -1193,7 +1207,7 @@ bool CDriverGL::restoreScreenMode()
|
|||
}
|
||||
}
|
||||
|
||||
#endif // XRANDR
|
||||
#endif // HAVE_XRANDR
|
||||
|
||||
#if defined(XF86VIDMODE)
|
||||
|
||||
|
@ -1302,7 +1316,7 @@ bool CDriverGL::setScreenMode(const GfxMode &mode)
|
|||
|
||||
bool found = false;
|
||||
|
||||
#ifdef XRANDR
|
||||
#ifdef HAVE_XRANDR
|
||||
|
||||
if (!found && _xrandr_version > 0)
|
||||
{
|
||||
|
@ -1347,7 +1361,7 @@ bool CDriverGL::setScreenMode(const GfxMode &mode)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // HAVE_XRANDR
|
||||
|
||||
#if defined(XF86VIDMODE)
|
||||
|
||||
|
@ -1895,7 +1909,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
|||
bool found = false;
|
||||
int screen = DefaultScreen(_dpy);
|
||||
|
||||
#if defined(XRANDR)
|
||||
#if defined(HAVE_XRANDR)
|
||||
if (!found && _xrandr_version >= 100)
|
||||
{
|
||||
XRRScreenConfiguration *screen_config = XRRGetScreenInfo(_dpy, RootWindow(_dpy, screen));
|
||||
|
@ -2029,7 +2043,7 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode)
|
|||
bool found = false;
|
||||
int screen = DefaultScreen(_dpy);
|
||||
|
||||
#ifdef XRANDR
|
||||
#ifdef HAVE_XRANDR
|
||||
|
||||
if (!found && _xrandr_version > 0)
|
||||
{
|
||||
|
@ -2068,7 +2082,7 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode)
|
|||
}
|
||||
}
|
||||
|
||||
#endif // XRANDR
|
||||
#endif // HAVE_XRANDR
|
||||
|
||||
#ifdef XF86VIDMODE
|
||||
|
||||
|
|
Loading…
Reference in a new issue