Sophie

Sophie

distrib > * > 2008.0 > x86_64 > media > main-updates-src > by-pkgid > e2344d49acb1512913347b9a9ddd8517 > files > 4

qt4-4.3.1-12.1mdv2008.0.src.rpm

qt-bugs@ issue :  none
Trolltech task ID : none
bugs.kde.org number :
applied: yes
author: Dirk Mueller

only trust libxinerama if its not the emulated information
coming from xrandr 1.2. xrandr 1.2 is merged fb and libxinerama
presents then virtual screens in clone mode, which qt (and KDE)
can't deal with.

proper fix would be to detect crtcs as virtual screens, but
given that qt can't deal with dynamically changing number of screens,
this is for "when I have time".

--- src/gui/kernel/qdesktopwidget_x11.cpp
+++ src/gui/kernel/qdesktopwidget_x11.cpp
@@ -124,11 +124,38 @@
     int unused;
     use_xinerama = (XineramaQueryExtension(X11->display, &unused, &unused) && XineramaIsActive(X11->display));
 
+    // only use xinerama for old Xrandr versions
+#ifndef QT_NO_XRANDR
+    int ncrtc = 0;
+    if (X11->use_xrandr) {
+        int major, minor;
+
+#if RANDR_MAJOR > 1 || RANDR_MINOR > 1
+        XRRQueryVersion(QPaintDevice::x11AppDisplay(), &major, &minor);
+        if (major > 1 || (major == 1 && minor >= 2)) {
+            XRRScreenResources* res;
+            res = XRRGetScreenResources(QPaintDevice::x11AppDisplay(),
+                    QPaintDevice::x11AppRootWindow( 0 ));
+            if (res) {
+                ncrtc = res->ncrtc;
+                XRRFreeScreenResources(res);
+            }
+        }
+#endif
+    }
+#endif
+
     if (use_xinerama) {
         xinerama_screeninfo =
             XineramaQueryScreens(X11->display, &screenCount);
         defaultScreen = 0;
-    } else
+    }
+#ifndef QT_NO_XRANDR
+    if (use_xinerama && screenCount <= ncrtc) {
+        use_xinerama = FALSE;
+    }
+#endif
+    else
 #endif // QT_NO_XINERAMA
     {
         defaultScreen = DefaultScreen(X11->display);