- 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);
- XClearWindow (st->dpy, st->window);
+ if (st->image || get_boolean_resource (st->dpy, "grab", "Boolean"))
+ {
+ if (st->image) XDestroyImage (st->image);
+ st->image = 0;
+
+ if (st->loading_pixmap) abort();
+ if (st->img_loader) abort();
+ if (!get_boolean_resource (st->dpy, "peek", "Boolean"))
+ st->loading_pixmap = XCreatePixmap (st->dpy, st->window,
+ st->xgwa.width, st->xgwa.height,
+ st->xgwa.depth);
+
+ XClearWindow (st->dpy, st->window);
+ st->img_loader = load_image_async_simple (0, st->xgwa.screen,
+ st->window,
+ (st->loading_pixmap
+ ? st->loading_pixmap
+ : st->window),
+ 0, 0);
+ }
+ else
+ {
+ st->ncolors = get_integer_resource (st->dpy, "colors", "Colors"); /* re-get */
+ if (st->ncolors < 1) st->ncolors = 1;
+ make_smooth_colormap (st->dpy, st->xgwa.visual, st->xgwa.colormap,
+ st->colors, &st->ncolors, True, 0, False);
+ if (st->ncolors < 1) abort();
+ XClearWindow (st->dpy, st->window);
+ }