-/* xscreensaver, Copyright (c) 1997, 1998, 2006 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1997-2015 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
{
struct starfish *s = (struct starfish *) calloc(1, sizeof(*s));
int i;
- int mid;
s->blob_p = st->blob_p;
s->elasticity = SCALE * get_float_resource (st->dpy, "thickness", "Thickness");
s->min_r = 0;
if (s->min_r < (5*SCALE)) s->min_r = (5*SCALE);
- mid = ((s->min_r + s->max_r) / 2);
s->x = maxx/2;
s->y = maxy/2;
size = (xgwa.width < xgwa.height ? xgwa.width : xgwa.height);
if (st->blob_p) size /= 2;
else size *= 1.3;
+
+ if (xgwa.width < 100 || xgwa.height < 100) /* tiny window */
+ {
+ size = (xgwa.width > xgwa.height ? xgwa.width : xgwa.height);
+ if (size < 100) size = 100;
+ }
+
return make_starfish (st, xgwa.width, xgwa.height, size);
}
if (st->done_once)
{
if (st->colors && st->ncolors)
- free_colors (st->dpy, st->cmap, st->colors, st->ncolors);
+ free_colors (xgwa.screen, st->cmap, st->colors, st->ncolors);
if (st->colors)
free (st->colors);
st->colors = 0;
+ XFreeGC (st->dpy, st->gc);
+ st->gc = 0;
}
st->ncolors = get_integer_resource (st->dpy, "colors", "Colors");
if (mono_p)
;
else if (random() % 3)
- make_smooth_colormap (st->dpy, xgwa.visual, st->cmap, st->colors, &st->ncolors,
+ make_smooth_colormap (xgwa.screen, xgwa.visual, st->cmap,
+ st->colors, &st->ncolors,
True, 0, True);
else
- make_uniform_colormap (st->dpy, xgwa.visual, st->cmap, st->colors, &st->ncolors,
+ make_uniform_colormap (xgwa.screen, xgwa.visual, st->cmap,
+ st->colors, &st->ncolors,
True, 0, True);
if (st->ncolors < 2) st->ncolors = 2;
flags |= GCFillRule;
gcv.fill_rule = EvenOddRule;
st->gc = XCreateGC (st->dpy, st->window, flags, &gcv);
+#ifdef HAVE_JWXYZ
+ if (!st->blob_p)
+ jwxyz_XSetAntiAliasing (st->dpy, st->gc, False);
+#endif
return make_window_starfish (st);
}
st->delay2 = get_integer_resource (st->dpy, "delay2", "Delay") * 1000000;
/* st->duration = get_seconds_resource (st->dpy, "duration", "Seconds");*/
st->duration = get_integer_resource (st->dpy, "duration", "Seconds");
- st->direction = (random() % 1) ? 1 : -1;
+ st->direction = (random() & 1) ? 1 : -1;
s = get_string_resource (st->dpy, "mode", "Mode");
if (s && !strcasecmp (s, "blob"))
if (st->duration > 0)
{
if (st->start_time == 0)
- st->start_time = time ((time_t) 0);
- now = time ((time_t) 0);
+ st->start_time = time ((time_t *) 0);
+ now = time ((time_t *) 0);
if (st->start_time + st->duration < now)
{
st->start_time = now;
s = reset_starfish (st);
else
s = make_window_starfish (st);
+
+ st->starfish = s;
}
}
starfish_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
+ struct state *st = (struct state *) closure;
+ free_starfish (st->starfish);
+ st->starfish = 0;
+ st->starfish = reset_starfish (st);
}
static Bool
static const char *starfish_defaults [] = {
".background: black",
".foreground: white",
+ "*fpsSolid: true",
"*delay: 10000",
"*thickness: 0", /* pixels, 0 = random */
"*rotation: -1", /* degrees, -1 = "random" */
"*duration: 30",
"*delay2: 5",
"*mode: random",
+#ifdef HAVE_MOBILE
+ "*ignoreRotation: True",
+#endif
0
};