+ st->dpy = dpy;
+ st->window = window;
+
+ XGetWindowAttributes(dpy, window, &st->xgwa);
+
+ st->ncolors = get_integer_resource (st->dpy, "colors", "Colors");
+ st->ncolors++;
+ st->colors = (XColor *) malloc(sizeof(*st->colors) * (st->ncolors+1));
+
+ gcv.foreground = get_pixel_resource(dpy, st->xgwa.colormap,
+ "foreground", "Foreground");
+ gcv.background = get_pixel_resource(dpy, st->xgwa.colormap,
+ "background", "Background");
+
+ {
+ XColor fgc, bgc;
+ int fgh, bgh;
+ double fgs, fgv, bgs, bgv;
+ fgc.pixel = gcv.foreground;
+ bgc.pixel = gcv.background;
+ XQueryColor (st->dpy, st->xgwa.colormap, &fgc);
+ XQueryColor (st->dpy, st->xgwa.colormap, &bgc);
+ rgb_to_hsv (fgc.red, fgc.green, fgc.blue, &fgh, &fgs, &fgv);
+ rgb_to_hsv (bgc.red, bgc.green, bgc.blue, &bgh, &bgs, &bgv);
+#if 0
+ bgh = fgh;
+ bgs = fgs;
+ bgv = fgv / 10.0;
+#endif
+ make_color_ramp (st->xgwa.screen, st->xgwa.visual, st->xgwa.colormap,
+ bgh, bgs, bgv,
+ fgh, fgs, fgv,
+ st->colors, &st->ncolors,
+ False, /* closed */
+ True, False);
+ }
+
+ st->f = init_field();
+
+ st->f->height = st->xgwa.height;
+ st->f->width = st->xgwa.width;
+ st->f->visdepth = st->xgwa.depth;
+
+ st->draw_delay = (get_integer_resource(dpy, "drawDelay", "Integer"));
+ st->f->maxrider = (get_integer_resource(dpy, "maxRiders", "Integer"));
+ st->f->maxradius = (get_integer_resource(dpy, "maxRadius", "Integer"));
+ st->f->initial_discs = (get_integer_resource(dpy, "numDiscs", "Integer"));