+ st->shadow_gc = XCreateGC(st->dpy, st->window, GCForeground|GCLineWidth|GCCapStyle, &gcv);
+
+ st->delay2 = 1000000 * get_integer_resource(st->dpy, "delay2", "Delay2");
+
+ return st;
+}
+
+static unsigned long
+celtic_draw (Display *dpy, Window window, void *closure)
+{
+ struct state *st = (struct state *) closure;
+
+ if (st->eraser) {
+ st->eraser = erase_window (st->dpy, st->window, st->eraser);
+ return 10000;
+ }
+
+ if (st->reset) {
+ st->reset = 0;
+
+ pattern_del(st->pattern);
+ st->pattern = NULL;
+ graph_del(st->graph);
+
+ /* recolor each time */
+ st->ncolors = get_integer_resource (st->dpy, "ncolors", "Integer");
+ if (st->ncolors > 2)
+ make_smooth_colormap (st->dpy, st->xgwa.visual, st->xgwa.colormap,
+ st->colors, &st->ncolors, True, 0, True);
+
+ st->eraser = erase_window (st->dpy, st->window, st->eraser);
+ return st->delay2;
+ }
+
+ if (st->pattern == NULL) {
+ st->params.curve_width=random()%5+4;
+ st->params.shadow_width=st->params.curve_width+4;
+ st->params.shape1=(15+random()%15)/10.0 -1.0;
+ st->params.shape2=(15+random()%15)/10.0 -1.0;
+ st->params.edge_size=10*(random()%5)+20;
+ st->params.delay=get_integer_resource(st->dpy, "delay", "Delay");
+ st->params.angle=random()%360*2*M_PI/360;
+ st->params.margin=(random()%8)*100-600;