- if (iterations > 0 && ++i >= iterations)
- {
- i = 0;
- if (!mono_p)
- XSetWindowBackground(dpy, window,
- colors[random() % ncolors].pixel);
- XClearWindow(dpy, window);
- }
- paint();
- XSync(dpy, False);
- if (delay)
- usleep(delay);
+ int i;
+ st->ncolors2 = st->ncolors;
+ st->colors2 = (XColor *) malloc(sizeof(*st->colors2) * (st->ncolors2+1));
+
+ for (i = 0; i < st->ncolors2; i++)
+ {
+# ifdef HAVE_JWXYZ
+ /* give a non-opaque alpha to the shadow colors */
+ unsigned long pixel = st->colors[i].pixel;
+ unsigned long amask = BlackPixelOfScreen (st->xgwa.screen);
+ unsigned long a = (0x77777777 & amask);
+ pixel = (pixel & (~amask)) | a;
+ st->colors2[i].pixel = pixel;
+# else /* !HAVE_JWXYZ */
+ int h;
+ double s, v;
+ rgb_to_hsv (st->colors[i].red,
+ st->colors[i].green,
+ st->colors[i].blue,
+ &h, &s, &v);
+ v *= 0.4;
+ hsv_to_rgb (h, s, v,
+ &st->colors2[i].red,
+ &st->colors2[i].green,
+ &st->colors2[i].blue);
+ st->colors2[i].pixel = st->colors[i].pixel;
+ XAllocColor (st->dpy, st->xgwa.colormap, &st->colors2[i]);
+# endif /* !HAVE_JWXYZ */
+ }
+ }
+# endif /* !DO_STIPPLE */
+
+ st->delay = get_integer_resource (st->dpy, "delay", "Delay");
+ st->iterations = get_integer_resource (st->dpy, "iterations", "Iterations");
+
+ return st;
+}
+
+static unsigned long
+cynosure_draw (Display *dpy, Window window, void *closure)
+{
+ struct state *st = (struct state *) closure;
+ if (st->iterations > 0 && ++st->i >= st->iterations)
+ {
+ st->i = 0;
+ if (!mono_p)
+ XSetWindowBackground(st->dpy, st->window,
+ st->colors[random() % st->ncolors].pixel);
+ XClearWindow(st->dpy, st->window);