Only query once for XFree86-VidModeExtension

currentRefreshRate is called after each randr event and we don't
need to query the extension each time.

REVIEW: 122272
This commit is contained in:
Martin Gräßlin 2015-01-27 14:58:49 +01:00
parent 9144b03688
commit c4807c5b60

View file

@ -55,7 +55,8 @@ int currentRefreshRate()
else if (GLPlatform::instance()->driver() == Driver_NVidia) {
#ifndef KWIN_NO_XF86VM
int major, event, error;
if (XQueryExtension(display(), "XFree86-VidModeExtension", &major, &event, &error)) {
static const bool s_hasVidMode = XQueryExtension(display(), "XFree86-VidModeExtension", &major, &event, &error);
if (s_hasVidMode) {
XF86VidModeModeLine modeline;
int dotclock, vtotal;
if (XF86VidModeGetModeLine(display(), 0, &dotclock, &modeline)) {