- st->ncolors = get_integer_resource ("colors", "Colors"); /* re-get this */
- make_smooth_colormap (st->dpy, st->xgwa.visual, st->xgwa.colormap,
- st->colors, &st->ncolors, True, 0, False);
+ if (st->image || get_boolean_resource ("grab", "Boolean"))
+ {
+ Pixmap p = 0;
+ if (st->image) XDestroyImage (st->image);
+ st->image = 0;
+
+ if (!get_boolean_resource ("peek", "Boolean"))
+ p = XCreatePixmap (st->dpy, st->window,
+ st->xgwa.width, st->xgwa.height,
+ st->xgwa.depth);
+
+ load_random_image (st->xgwa.screen, st->window,
+ (p ? p : st->window), 0, 0);
+ st->image = XGetImage (st->dpy, (p ? p : st->window), 0, 0,
+ st->xgwa.width, st->xgwa.height, ~0L, ZPixmap);
+ if (p) XFreePixmap (st->dpy, p);
+ XSync (st->dpy, False);
+ XSetWindowBackground (st->dpy, st->window, st->bg_color);
+ if (!p) sleep (2);
+ }
+ else
+ {
+ st->ncolors = get_integer_resource ("colors", "Colors"); /* re-get */
+ make_smooth_colormap (st->dpy, st->xgwa.visual, st->xgwa.colormap,
+ st->colors, &st->ncolors, True, 0, False);
+ }
+