http://ftp.x.org/contrib/applications/xscreensaver-3.03.tar.gz
[xscreensaver] / utils / visual.c
index c83643601773299068623af60775a641a513c36a..a570bcc4342e9653bf70efe53bdc8e0043610b99 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
- *  by Jamie Zawinski <jwz@netscape.com>
+ *  by 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
@@ -369,12 +369,14 @@ has_writable_cells (Screen *screen, Visual *visual)
       return False;
     default:
       abort();
+      return False;
     }
 }
 
 void
-describe_visual (FILE *f, Screen *screen, Visual *visual)
+describe_visual (FILE *f, Screen *screen, Visual *visual, Bool private_cmap_p)
 {
+  char n[10];
   Display *dpy = DisplayOfScreen (screen);
   XVisualInfo vi_in, *vi_out;
   int out_count;
@@ -383,7 +385,12 @@ describe_visual (FILE *f, Screen *screen, Visual *visual)
   vi_out = XGetVisualInfo (dpy, (VisualScreenMask | VisualIDMask),
                           &vi_in, &out_count);
   if (! vi_out) abort ();
-  fprintf (f, "0x%02x (%s depth: %2d, cmap: %3d)\n",
+  if (private_cmap_p)
+    sprintf(n, "%3d", vi_out->colormap_size);
+  else
+    strcpy(n, "default");
+
+  fprintf (f, "0x%02x (%s depth: %2d, cmap: %s)\n",
           (unsigned int) vi_out->visualid,
           (vi_out->class == StaticGray  ? "StaticGray, " :
            vi_out->class == StaticColor ? "StaticColor," :
@@ -392,7 +399,7 @@ describe_visual (FILE *f, Screen *screen, Visual *visual)
            vi_out->class == PseudoColor ? "PseudoColor," :
            vi_out->class == DirectColor ? "DirectColor," :
                                           "UNKNOWN:    "),
-          vi_out->depth, vi_out->colormap_size /*, vi_out->bits_per_rgb*/);
+          vi_out->depth, n);
   XFree ((char *) vi_out);
 }
 
@@ -405,6 +412,7 @@ screen_number (Screen *screen)
     if (ScreenOfDisplay (dpy, i) == screen)
       return i;
   abort ();
+  return 0;
 }
 
 int