All pastes #491581 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-16 19:14 UTC
rendered paste body
Index: libs/libmyth/DisplayResX.cpp
===================================================================
--- libs/libmyth/DisplayResX.cpp        (revision 13456)
+++ libs/libmyth/DisplayResX.cpp        (working copy)
@@ -52,8 +52,12 @@
                                               desired_screen, rate);
     if (idx >= 0)
     {
-        Display *display = NULL;
-        XRRScreenConfiguration *cfg = GetScreenConfig(display);
+        Display *display = MythXOpenDisplay();
+        if (!display)
+            return false;
+        XRRScreenConfiguration *cfg=NULL;
+        if (XRRQueryExtension(display,NULL,NULL))
+            cfg = GetScreenConfig(display);
         if (!cfg)
             return false;

@@ -82,8 +86,12 @@
     if (m_video_modes.size())
         return m_video_modes;

-    Display *display = NULL;
-    XRRScreenConfiguration *cfg = GetScreenConfig(display);
+    Display *display = MythXOpenDisplay();
+    if (!display)
+        return m_video_modes;
+    XRRScreenConfiguration *cfg=NULL;
+    if (XRRQueryExtension(display,NULL,NULL))
+        cfg = GetScreenConfig(display);
     if (!cfg)
         return m_video_modes;

@@ -121,7 +129,9 @@

     X11L;
     Window root = RootWindow(display, DefaultScreen(display));
-    XRRScreenConfiguration *cfg = XRRGetScreenInfo(display, root);
+    XRRScreenConfiguration *cfg=NULL;
+    if (XRRQueryExtension(display,NULL,NULL))
+        cfg = XRRGetScreenInfo(display, root);
     if (!cfg)
     {
         if (display)