Port detection of screen rate to XCB

New wrapper class added to xcbutils in a new RandR namespace.
icc-effect-5.14.5
Martin Gräßlin 2013-08-01 08:38:05 +02:00
parent 36429c0010
commit becb5c2dc1
2 changed files with 8 additions and 4 deletions

View File

@ -40,7 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "xcbutils.h"
#include <kwinglplatform.h>
#include <X11/extensions/Xrandr.h>
#ifndef KWIN_HAVE_OPENGLES
#ifndef KWIN_NO_XF86VM
#include <X11/extensions/xf86vmode.h>
@ -100,9 +99,8 @@ int currentRefreshRate()
}
#endif
else if (Xcb::Extensions::self()->isRandrAvailable()) {
XRRScreenConfiguration *config = XRRGetScreenInfo(display(), rootWindow());
rate = XRRConfigCurrentRate(config);
XRRFreeScreenConfigInfo(config);
Xcb::RandR::ScreenInfo screenInfo(rootWindow());
rate = screenInfo->rate;
}
// 0Hz or less is invalid, so we fallback to a default rate

View File

@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <xcb/xcb.h>
#include <xcb/composite.h>
#include <xcb/randr.h>
#define class class_name //HACK: work around a non-C++ safe problem in xcb_iccm.h
//where they put a variable called "class" in function signatures.
//Needed at least for xcb v0.3.8
@ -234,6 +235,11 @@ public:
}
};
namespace RandR
{
typedef Wrapper<xcb_randr_get_screen_info_reply_t, xcb_randr_get_screen_info_cookie_t, &xcb_randr_get_screen_info_reply, &xcb_randr_get_screen_info_unchecked> ScreenInfo;
}
class ExtensionData
{
public: