X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fcritical.c;h=81fd0c1a1056547e789302e5082bb4f03541f596;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=5669304b374df58b38c1bb18d146c3f88d4b5f45;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/critical.c b/hacks/critical.c index 5669304b..81fd0c1a 100644 --- a/hacks/critical.c +++ b/hacks/critical.c @@ -100,8 +100,10 @@ model_allocate (int model_w, int model_h) mm->height = model_h; mm->cells = malloc (sizeof (unsigned short) * model_w * model_h); - if (!mm->cells) + if (!mm->cells) { + free (mm); return 0; + } return mm; } @@ -216,21 +218,21 @@ setup_colormap (struct state *st, XColor **colors, int *n_colors) if (!strcmp (color_scheme, "random")) { - make_random_colormap (st->dpy, st->wattr.visual, + make_random_colormap (st->wattr.screen, st->wattr.visual, st->wattr.colormap, *colors, n_colors, True, True, &writable, True); } else if (!strcmp (color_scheme, "smooth")) { - make_smooth_colormap (st->dpy, st->wattr.visual, + make_smooth_colormap (st->wattr.screen, st->wattr.visual, st->wattr.colormap, *colors, n_colors, True, &writable, True); } else { - make_uniform_colormap (st->dpy, st->wattr.visual, + make_uniform_colormap (st->wattr.screen, st->wattr.visual, st->wattr.colormap, *colors, n_colors, True, &writable, True); @@ -242,7 +244,7 @@ setup_colormap (struct state *st, XColor **colors, int *n_colors) static void free_colormap (struct state *st, XColor **colors, int n_colors) { - free_colors (st->dpy, st->wattr.colormap, *colors, n_colors); + free_colors (st->wattr.screen, st->wattr.colormap, *colors, n_colors); free (*colors); } @@ -289,7 +291,8 @@ critical_init (Display *dpy, Window window) screens. */ model_w = 80; st->settings.cell_size = st->wattr.width / model_w; - model_h = st->wattr.height / st->settings.cell_size; + model_h = st->settings.cell_size ? + st->wattr.height / st->settings.cell_size : 1; /* Construct the initial model state. */ @@ -318,7 +321,7 @@ critical_init (Display *dpy, Window window) st->fgc = XCreateGC (st->dpy, st->window, 0, &st->gcv); -#ifdef HAVE_COCOA +#ifdef HAVE_JWXYZ jwxyz_XSetAntiAliasing (dpy, st->fgc, False); jwxyz_XSetAntiAliasing (dpy, st->bgc, False); #endif @@ -437,6 +440,7 @@ static XrmOptionDescRec critical_options[] = { /* Default xrm resources. */ static const char *critical_defaults[] = { ".background: black", + "*fpsSolid: true", "*colorscheme: smooth", "*delay: 10000", "*ncolors: 64",