From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / hacks / whirlygig.c
index d4205bf8b141c3165b2b0ff028ec8e5dbae93900..22c7ddd650908981b4002950a994c2b507312a35 100644 (file)
@@ -307,6 +307,7 @@ static int preen(int current, int max) {
     return(current);
 }
 
+#if 0
 static void
 smoothen(struct state *st, int x, int lastx, int y, int lasty, int size, int last_color, XColor *colors, Display *dpy, Window window, GC bgc, int screen, struct info *info)
 {
@@ -327,6 +328,7 @@ smoothen(struct state *st, int x, int lastx, int y, int lasty, int size, int las
         smoothen(st, newx, x, newy, y, size, last_color, st->colors, st->dpy, st->window, st->bgc, st->screen, st->info);
     }
 }
+#endif
 
 
 static void *
@@ -340,7 +342,7 @@ whirlygig_init (Display *dpy, Window window)
 
     st->dbuf = get_boolean_resource (st->dpy, "doubleBuffer", "Boolean");
 
-# ifdef HAVE_COCOA     /* Don't second-guess Quartz's double-buffering */
+# ifdef HAVE_JWXYZ     /* Don't second-guess Quartz's double-buffering */
     st->dbuf = False;
 # endif
 
@@ -380,14 +382,16 @@ whirlygig_init (Display *dpy, Window window)
     st->gcv.foreground = get_pixel_resource(st->dpy, st->xgwa.colormap, "background", "Background");
     st->bgc = XCreateGC (st->dpy, st->b, GCForeground, &st->gcv);
 
-#ifdef HAVE_COCOA  /* #### should turn off double-buffering instead */
+#ifdef HAVE_JWXYZ  /* #### should turn off double-buffering instead */
     jwxyz_XSetAntiAliasing (dpy, st->fgc, False);
     jwxyz_XSetAntiAliasing (dpy, st->bgc, False);
 #endif
 
     {
       Bool writable_p = False;
-    make_uniform_colormap (st->dpy, st->xgwa.visual, st->xgwa.colormap, st->colors, &st->ncolors, True, &writable_p, True);
+    make_uniform_colormap (st->xgwa.screen, st->xgwa.visual,
+                           st->xgwa.colormap, st->colors, &st->ncolors,
+                           True, &writable_p, True);
     }
 
     if (st->ba) XFillRectangle (st->dpy, st->ba, st->bgc, 0, 0, st->xgwa.width, st->xgwa.height);
@@ -406,7 +410,7 @@ whirlygig_init (Display *dpy, Window window)
     st->info->half_width = st->xgwa.width / 2;
     st->info->half_height = st->xgwa.height / 2;
     st->info->speed = get_integer_resource(st->dpy, "speed" , "Integer");
-    st->info->trail = get_integer_resource(st->dpy, "trail", "Integer");
+    st->info->trail = get_boolean_resource(st->dpy, "trail", "Integer");
     st->info->color_modifier = get_integer_resource(st->dpy, "color_modifier", "Integer");
     st->info->xoffset = get_float_resource(st->dpy, "xoffset", "Float");
     st->info->yoffset = get_float_resource(st->dpy, "yoffset", "Float");
@@ -499,11 +503,9 @@ whirlygig_draw (Display *dpy, Window window, void *closure)
     st->current_color = 0;
   for (wcount = 0; wcount < st->info->whirlies; wcount++) {
     int lcount; /* lcount is a counter for every line -- take note of the offsets changing */
-    int internal_time = st->current_time;
+    int internal_time = 0;
     int color_offset = (st->current_color + (st->info->color_modifier * wcount)) % NCOLORS;
-    if (st->current_time == 0)
-      internal_time = 0;
-    else
+    if (st->current_time != 0)
       /* I want the distance between whirlies to increase more each whirly */
       internal_time = st->current_time + (10 * wcount) + (wcount * wcount); 
     switch (st->xmode) {
@@ -659,6 +661,7 @@ whirlygig_free (Display *dpy, Window window, void *closure)
 static const char *whirlygig_defaults [] = {
   ".background: black",
   ".foreground: white",
+  "*fpsSolid:  true",
   "*xspeed: 1.0",
   "*yspeed: 1.0",
   "*xamplitude: 1.0",
@@ -668,7 +671,7 @@ static const char *whirlygig_defaults [] = {
   "*xmode: change",
   "*ymode: change",
   "*speed: 1",
-  "*trail: 0",
+  "*trail: false",
   "*color_modifier: -1",
   "*start_time: -1",
   "*explain: False",
@@ -704,7 +707,7 @@ static XrmOptionDescRec whirlygig_options [] = {
   { "-ymode",       ".ymode", XrmoptionSepArg, 0 },
   { "-speed",        ".speed", XrmoptionSepArg, 0 },
       /*  This will modify how often it should draw, changing it will probably suck */
-  { "-trail",           ".trail", XrmoptionSepArg, 0 },
+  { "-trail",           ".trail", XrmoptionNoArg, "True" },
       /* Control whether or not you want the old circles to be erased */
   { "-color_modifier",          ".color_modifier", XrmoptionSepArg, 0 },
       /*  How many colors away from the current should the next whirly be? */