- int border;
- unsigned long fg, bg;
- Drawable d;
- Colormap cmap;
- Visual *visual;
-
- XGetWindowAttributes (dpy, window, &xgwa);
- grab_screen_image (xgwa.screen, window);
- cmap = xgwa.colormap;
- visual = xgwa.visual;
- max_width = xgwa.width;
- max_height = xgwa.height;
-
- delay = get_integer_resource ("delay", "Integer");
- delay2 = get_integer_resource ("delay2", "Integer");
- grid_size = get_integer_resource ("gridSize", "Integer");
- pix_inc = get_integer_resource ("pixelIncrement", "Integer");
- border = get_integer_resource ("internalBorderWidth", "InternalBorderWidth");
-
- /* Don't let the grid be smaller than 3x3 */
- if (grid_size > xgwa.width / 3)
- grid_size = xgwa.width / 3;
- if (grid_size > xgwa.height / 3)
- grid_size = xgwa.height / 3;
+
+ st->dpy = dpy;
+ st->window = window;
+ 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);
+
+ st->max_width = xgwa.width;
+ st->max_height = xgwa.height;
+
+ st->delay = get_integer_resource (st->dpy, "delay", "Integer");
+ st->delay2 = get_integer_resource (st->dpy, "delay2", "Integer");
+ st->duration = get_integer_resource (st->dpy, "duration", "Seconds");
+ st->grid_size = get_integer_resource (st->dpy, "gridSize", "Integer");
+ st->pix_inc = get_integer_resource (st->dpy, "pixelIncrement", "Integer");
+
+ /* Don't let the grid be smaller than 5x5 */
+ while (st->grid_size > xgwa.width / 5)
+ st->grid_size /= 2;
+ while (st->grid_size > xgwa.height / 5)
+ st->grid_size /= 2;
+
+ if (st->delay < 0) st->delay = 0;
+ if (st->delay2 < 0) st->delay2 = 0;
+ if (st->duration < 1) st->duration = 1;
+ if (st->pix_inc < 1) st->pix_inc = 1;
+ if (st->grid_size < 1) st->grid_size = 1;
+