[Spice-devel] [PATCH 1/2] client/x11/platform: don't call XRRSelectInput if no xrandr extension

Alon Levy alevy at redhat.com
Mon Nov 14 05:09:42 PST 2011


---
 client/x11/platform.cpp |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 9094a64..c66386d 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -1113,6 +1113,15 @@ private:
     bool _out_of_sync;
 };
 
+inline int has_xrandr(void)
+{
+    return using_xrandr_1_0
+#ifdef USE_XRANDR_1_2
+        || using_xrandr_1_2
+#endif
+    ;
+}
+
 XineramaScreen::XineramaScreen(Display* display, int screen, int& next_mon_id,
                                XineramaScreenInfo* xin_screens, int num_xin_screens)
     : XScreen(display, screen)
@@ -1123,8 +1132,10 @@ XineramaScreen::XineramaScreen(Display* display, int screen, int& next_mon_id,
     }
     Window root_window = RootWindow(display, screen);
     XSelectInput(display, root_window, StructureNotifyMask);
-    XRRSelectInput(display, root_window, RRScreenChangeNotifyMask);     // TODO: this fails if we don't have RR extension (but do have XINERAMA)
-    XPlatform::set_win_proc(root_window, root_win_proc);     // Xlib:  extension "RANDR" missing on display ":3.0".
+    if (has_xrandr()) {
+        XRRSelectInput(display, root_window, RRScreenChangeNotifyMask);
+    }
+    XPlatform::set_win_proc(root_window, root_win_proc);
     X_DEBUG_SYNC(display);
 }
 
-- 
1.7.7.3



More information about the Spice-devel mailing list