+static unsigned long
+rotzoomer_draw (Display *disp, Window win, void *closure)
+{
+ struct state *st = (struct state *) closure;
+ int delay = st->delay;
+ int i;
+
+ if (st->img_loader) /* still loading */
+ {
+ st->img_loader = load_image_async_simple (st->img_loader, 0, 0, 0, 0, 0);
+ if (! st->img_loader) { /* just finished */
+ st->orig_map = XGetImage (st->dpy, st->window, 0, 0,
+ st->width, st->height, ~0L, ZPixmap);
+ init_hack (st);
+ }
+ return st->delay;
+ }
+
+ if (!st->img_loader &&
+ st->start_time + st->duration < time ((time_t) 0)) {
+ XWindowAttributes xgwa;
+ XGetWindowAttributes(st->dpy, st->window, &xgwa);
+ st->img_loader = load_image_async_simple (0, xgwa.screen, st->window,
+ st->window, 0, 0);
+ st->start_time = time ((time_t) 0);
+ return st->delay;
+ }
+
+ for (i = 0; i < st->num_zoom; i++) {
+ if (st->move || st->sweep)
+ update_position (st->zoom_box[i]);
+
+ if (st->zoom_box[i]->n > 0) {
+ if (st->anim || st->zoom_box[i]->count == 0) {
+ rotzoom (st, st->zoom_box[i]);
+ } else {
+ delay = 1000000;
+ }
+ st->zoom_box[i]->n--;
+ } else {
+ reset_zoom (st, st->zoom_box[i]);
+ }
+ }
+
+ for (i = 0; i < st->num_zoom; i++) {
+ DisplayImage(st, st->zoom_box[i]->x, st->zoom_box[i]->y,
+ st->zoom_box[i]->w, st->zoom_box[i]->h);
+ }
+
+ return delay;