if(!st->board) exit(1);
cmap = xgwa.colormap;
if( st->ncolors ) {
- free_colors(st->dpy, cmap, st->colors, st->ncolors);
+ free_colors(xgwa.screen, cmap, st->colors, st->ncolors);
st->ncolors = 0;
}
gcv.foreground = st->default_fg_pixel = get_pixel_resource(st->dpy, cmap, "foreground", "Foreground");
gcv.foreground = get_pixel_resource (st->dpy, cmap, "background", "Background");
st->erase_gc = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
st->ncolors = NCOLORSMAX;
- make_uniform_colormap(st->dpy, xgwa.visual, cmap, st->colors, &st->ncolors, True, &writeable, False);
+ make_uniform_colormap(xgwa.screen, xgwa.visual, cmap,
+ st->colors, &st->ncolors, True, &writeable, False);
if (st->ncolors <= 0) {
st->ncolors = 2;
st->colors[0].red = st->colors[0].green = st->colors[0].blue = 0;
st->colorsloth = st->nwalkers*2/st->ncolors;
XSetForeground(st->dpy, st->draw_gc, st->colors[st->colorindex].pixel);
+ if ((st->width <= 2) || (st->height <= 2)) return;
+
for( i = 0; i < seeds; i++ ) {
int x, y;
+ int max_repeat = 10;
do {
x = 1 + random() % (st->width - 2);
y = 1 + random() % (st->height - 2);
- } while( getdot(x, y) );
+ } while( getdot(x, y) && max_repeat--);
setdot((x-1), (y-1)); setdot(x, (y-1)); setdot((x+1), (y-1));
setdot((x-1), y ); setdot(x, y ); setdot((x+1), y );
st->nwalkers--;
st->walkers[i].x = st->walkers[st->nwalkers].x;
st->walkers[i].y = st->walkers[st->nwalkers].y;
- if( 0 == (st->nwalkers%st->colorsloth) ) {
+ if( 0 ==
+ ((st->colorsloth ? st->nwalkers%st->colorsloth : 0)) ) {
color = True;
}
coral_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
+ struct state *st = (struct state *) closure;
+ init_coral(st);
}
static Bool
static const char *coral_defaults[] = {
".background: black",
".foreground: white",
+ "*fpsSolid: true",
"*density: 25",
"*seeds: 20", /* too many for 640x480, too few for 1280x1024 */
"*delay: 5",
"*delay2: 20000",
+#ifdef USE_IPHONE
+ "*ignoreRotation: True",
+#endif
0
};