+#if defined(HAVE_RANDR) && defined(HAVE_XINERAMA)
+
+/* From: Aaron Plattner <aplattner@nvidia.com>
+ Date: August 7, 2008 10:21:25 AM PDT
+ To: linux-bugs@nvidia.com
+
+ The NVIDIA X driver does not yet support RandR 1.2. The X server has
+ a compatibility layer in it that allows RandR 1.2 clients to talk to
+ RandR 1.1 drivers through an RandR 1.2 pseudo-output called "default".
+ This reports the total combined resolution of the TwinView display,
+ since it doesn't have any visibility into TwinView metamodes. There
+ is no way for the driver to prevent the server from turning on this
+ compatibility layer.
+
+ The intention is for X client applications to continue to use the
+ Xinerama extension to query the screen geometry. RandR 1.2 reports
+ its own Xinerama info for this purpose. I would recommend against
+ modifying xscreensaver to try to get this information from RandR.
+ */
+static monitor **
+randr_versus_xinerama_fight (Display *dpy, monitor **randr_monitors)
+{
+ monitor **xinerama_monitors;
+
+ if (!randr_monitors)
+ return 0;
+
+ xinerama_monitors = xinerama_scan_monitors (dpy);
+ if (!xinerama_monitors)
+ return randr_monitors;
+
+ if (! layouts_differ_p (randr_monitors, xinerama_monitors))
+ {
+ free_monitors (xinerama_monitors);
+ return randr_monitors;
+ }
+ else if ( randr_monitors[0] && !randr_monitors[1] && /* 1 monitor */
+ xinerama_monitors[0] && xinerama_monitors[1]) /* >1 monitor */
+ {
+ fprintf (stderr,
+ "%s: WARNING: RANDR reports 1 screen but Xinerama\n"
+ "%s: reports multiple. Believing Xinerama.\n",
+ blurb(), blurb());
+ free_monitors (randr_monitors);
+ return xinerama_monitors;
+ }
+ else
+ {
+ fprintf (stderr,
+ "%s: WARNING: RANDR and Xinerama report different\n"
+ "%s: screen layouts! Believing RANDR.\n",
+ blurb(), blurb());
+ free_monitors (xinerama_monitors);
+ return randr_monitors;
+ }
+}
+
+#endif /* HAVE_RANDR && HAVE_XINERAMA */
+
+