X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fstarfish.c;h=b192e280dcbbab4a7481dc05b963275cd671ab24;hb=c8c6deae79b408cffbc88043c766b3bc12cf0f13;hp=f013482baff954bd5088628566f9d16f68836df5;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/starfish.c b/hacks/starfish.c index f013482b..b192e280 100644 --- a/hacks/starfish.c +++ b/hacks/starfish.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1997, 1998, 2006 Jamie Zawinski +/* xscreensaver, Copyright (c) 1997-2007 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -345,6 +345,8 @@ reset_starfish (struct state *st) 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"); @@ -434,7 +436,7 @@ starfish_init (Display *dpy, Window window) 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")) @@ -479,6 +481,8 @@ starfish_draw (Display *dpy, Window window, void *closure) s = reset_starfish (st); else s = make_window_starfish (st); + + st->starfish = s; } }