From d218a8c9a781fe05b507eaeae0aa1a3ea13bd6a7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 4 Feb 2011 10:27:05 +0000 Subject: [PATCH] Added support for getting the current screen refresh rate using the XrandR extension. --- src/osgViewer/GraphicsWindowX11.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/osgViewer/GraphicsWindowX11.cpp b/src/osgViewer/GraphicsWindowX11.cpp index 7ce1c8c84..c3ff241c5 100644 --- a/src/osgViewer/GraphicsWindowX11.cpp +++ b/src/osgViewer/GraphicsWindowX11.cpp @@ -1910,7 +1910,22 @@ public: resolution.width = DisplayWidth(display, si.screenNum); resolution.height = DisplayHeight(display, si.screenNum); resolution.colorDepth = DefaultDepth(display, si.screenNum); + resolution.refreshRate = 0; // Missing call. Need a X11 expert. + + +#ifdef OSGVIEWER_USE_XRANDR + if (supportsRandr(display)) + { + + XRRScreenConfiguration* screenConfig = XRRGetScreenInfo ( display, RootWindow(display, si.screenNum) ); + + resolution.refreshRate = XRRConfigCurrentRate ( screenConfig ); + + XRRFreeScreenConfigInfo( screenConfig ); + } +#endif + XCloseDisplay(display); }