http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.01.tar.gz
[xscreensaver] / hacks / imsmap.c
index f89f95fede33925458a1d8262c4fbab7171f33bb..5db775d227af1a29138ba502c95b68b1e75c993d 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <stdio.h>
 #include <math.h>
+#include <time.h>
 #include <sys/time.h> /* for gettimeofday() */
 
 #include <X11/Xlib.h>
@@ -77,6 +78,7 @@ init_map (Display *dpy, Window window)
 
       if (ncolors <= 2) ncolors = 0;
       if (ncolors == 0) mono_p = True;
+      if (ncolors > 255) ncolors = 255;  /* too many look bad */
 
       fg_pixel = get_pixel_resource ("background", "Background", dpy, cmap);
       bg_pixel = get_pixel_resource ("foreground", "Foreground", dpy, cmap);