http://ftp.x.org/contrib/applications/xscreensaver-2.23.tar.gz
[xscreensaver] / hacks / rorschach.c
index eab1388743c82d4885cc38ed18309aa648ba7bdf..4b623628449a5a21de27de7961be7a77fcc722ff 100644 (file)
@@ -7,14 +7,19 @@
  * documentation.  No representations are made about the suitability of this
  * software for any purpose.  It is provided "as is" without express or 
  * implied warranty.
+ *
+ * 19971004: Johannes Keukelaar <johannes@nada.kth.se>: Use helix screen
+ *           eraser.
  */
 
 #include "screenhack.h"
+#include "erase.h"
 
 static GC draw_gc, erase_gc;
 static unsigned int default_fg_pixel;
 static int iterations, offset;
 static Bool xsym, ysym;
+static int sleep_time;
 
 static void
 init_rorschach (Display *dpy, Window window)
@@ -89,15 +94,10 @@ hurm (Display *dpy, Window window)
       XDrawPoints (dpy, window, draw_gc, points, j, CoordModeOrigin);
       XSync (dpy, True);
     }
-  sleep (5);
-  for (i = 0; i < (ylim >> 1); i++)
-    {
-      y = (random () % ylim);
-      XDrawLine (dpy, window, erase_gc, 0, y, xlim, y);
-      XFlush (dpy);
-      if ((i % 50) == 0)
-       usleep (10000);
-    }
+  sleep ( sleep_time );
+
+  erase_full_window(dpy, window);
+
   XClearWindow (dpy, window);
   if (got_color) XFreeColors (dpy, cmap, &color.pixel, 1, 0);
   XSync (dpy, True);
@@ -108,12 +108,13 @@ hurm (Display *dpy, Window window)
 char *progclass = "Rorschach";
 
 char *defaults [] = {
-  "Rorschach.background:       black",         /* to placate SGI */
-  "Rorschach.foreground:       white",
+  ".background:        black",
+  ".foreground:        white",
   "*xsymmetry: true",
   "*ysymmetry: false",
   "*iterations:        4000",
   "*offset:    4",
+  "*delay:     5",
   0
 };
 
@@ -122,12 +123,15 @@ XrmOptionDescRec options [] = {
   { "-offset",         ".offset",      XrmoptionSepArg, 0 },
   { "-xsymmetry",      ".xsymmetry",   XrmoptionNoArg, "true" },
   { "-ysymmetry",      ".ysymmetry",   XrmoptionNoArg, "true" },
+  { "-erase-speed",    ".eraseSpeed",          XrmoptionSepArg, 0 },
+  { "-delay",           ".delay",               XrmoptionSepArg, 0 },
   { 0, 0, 0, 0 }
 };
 
 void
 screenhack (Display *dpy, Window window)
 {
+  sleep_time = get_integer_resource("delay", "Integer");
   init_rorschach (dpy, window);
   while (1)
     hurm (dpy, window);