http://www.tienza.es/crux/src/www.jwz.org/xscreensaver/xscreensaver-5.06.tar.gz
[xscreensaver] / driver / test-randr.c
index 5ba24b4a9d1ab2a16df126c81a0a67915ccb76f7..0d57895ab6a2fece2ff9c75be30fd7fff22a8151 100644 (file)
@@ -1,5 +1,5 @@
 /* test-randr.c --- playing with the Resize And Rotate extension.
- * xscreensaver, Copyright (c) 2004 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 2004-2008 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -134,6 +134,9 @@ main (int argc, char **argv)
             XRRConfigCurrentConfiguration (rrc, &current_rotation);
 
           /* Times */
+# if 0    /* #### This is wrong -- I don't understand what these two
+                  timestamp numbers represent, or how they correlate
+                  to the wall clock or to each other. */
           {
             Time server_time, config_time;
             server_time = XRRConfigTimes (rrc, &config_time);
@@ -144,6 +147,7 @@ main (int argc, char **argv)
               fprintf (stderr, "%s:   config changed %lu seconds ago\n",
                        blurb(), (unsigned long) (server_time - config_time));
           }
+# endif
 
           /* Rotations */
           {
@@ -229,6 +233,43 @@ main (int argc, char **argv)
           fprintf(stderr, "%s:   XRRGetScreenInfo(dpy, %d) ==> NULL\n",
                   blurb(), i);
         }
+
+
+# ifdef HAVE_RANDR_12
+      if (major > 1 || (major == 1 && minor >= 2))
+        {
+          int j;
+          XRRScreenResources *res = 
+            XRRGetScreenResources (dpy, RootWindow (dpy, i));
+          fprintf (stderr, "\n");
+          for (j = 0; j < res->noutput; j++)
+            {
+              int k;
+              XRROutputInfo *rroi = 
+                XRRGetOutputInfo (dpy, res, res->outputs[j]);
+              fprintf (stderr, "%s:   Output %d: %s: %s (%d)\n", blurb(), j,
+                       rroi->name,
+                       (rroi->connection == RR_Disconnected ? "disconnected" :
+                        rroi->connection == RR_UnknownConnection ? "unknown" :
+                        "connected"),
+                       (int) rroi->crtc);
+              for (k = 0; k < rroi->ncrtc; k++)
+                {
+                  XRRCrtcInfo *crtci = XRRGetCrtcInfo (dpy, res, 
+                                                       rroi->crtcs[k]);
+                  fprintf(stderr, "%s:   %c CRTC %d (%d): %dx%d+%d+%d\n", 
+                          blurb(),
+                          (rroi->crtc == rroi->crtcs[k] ? '+' : ' '),
+                          k, (int) rroi->crtcs[k],
+                          crtci->width, crtci->height, crtci->x, crtci->y);
+                  XRRFreeCrtcInfo (crtci);
+                }
+              XRRFreeOutputInfo (rroi);
+              fprintf (stderr, "\n");
+            }
+          XRRFreeScreenResources (res);
+        }
+# endif /* HAVE_RANDR_12 */
     }
 
   if (major > 0)