From c4807c5b607eb4dda4a2071c959cffd747bb9cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 27 Jan 2015 14:58:49 +0100 Subject: [PATCH] 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 --- options.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/options.cpp b/options.cpp index caba701259..c9623fbadc 100644 --- a/options.cpp +++ b/options.cpp @@ -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)) {