summaryrefslogtreecommitdiffstats
path: root/krandr/randr.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-20 20:43:38 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-20 20:43:38 +0000
commit42dfcbcc0fe6019d32cd5680a86e2831fe9b6974 (patch)
tree81f15764d81efcdcb0ec9edeeaf534ce2ecc0d48 /krandr/randr.cpp
parente7c20618e624eb27aa17abcdc471f3711e94b914 (diff)
downloadtdelibs-42dfcbcc0fe6019d32cd5680a86e2831fe9b6974.tar.gz
tdelibs-42dfcbcc0fe6019d32cd5680a86e2831fe9b6974.zip
KRandRTray fixes; minor compilation repairs
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1152360 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krandr/randr.cpp')
-rw-r--r--krandr/randr.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/krandr/randr.cpp b/krandr/randr.cpp
index 63c5c0450..d56b37481 100644
--- a/krandr/randr.cpp
+++ b/krandr/randr.cpp
@@ -562,6 +562,20 @@ RandRDisplay::RandRDisplay()
return;
}
+ // Sometimes the extension is available but does not return any screens (!)
+ // Check for that case
+ Display *randr_display = XOpenDisplay(NULL);
+ int screen_num;
+ Window root_window;
+
+ screen_num = DefaultScreen (randr_display);
+ root_window = RootWindow (randr_display, screen_num);
+ if (XRRGetScreenResources (randr_display, root_window) == NULL) {
+ m_errorCode = i18n("No screens detected");
+ m_valid = false;
+ return;
+ }
+
int major_version, minor_version;
XRRQueryVersion(qt_xdisplay(), &major_version, &minor_version);