X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fstarfish.c;h=2e06ee9e297b3853b9ede5f6cb83bf63772a531f;hb=88cfe534a698a0562e81345957a50714af1453bc;hp=f013482baff954bd5088628566f9d16f68836df5;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/starfish.c b/hacks/starfish.c index f013482b..2e06ee9e 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-2015 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 @@ -341,10 +341,12 @@ reset_starfish (struct state *st) 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"); @@ -359,10 +361,12 @@ reset_starfish (struct state *st) 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; @@ -386,6 +390,10 @@ reset_starfish (struct state *st) flags |= GCFillRule; gcv.fill_rule = EvenOddRule; st->gc = XCreateGC (st->dpy, st->window, flags, &gcv); +#ifdef HAVE_COCOA + if (!st->blob_p) + jwxyz_XSetAntiAliasing (st->dpy, st->gc, False); +#endif return make_window_starfish (st); } @@ -434,7 +442,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")) @@ -465,8 +473,8 @@ starfish_draw (Display *dpy, Window window, void *closure) 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; @@ -479,6 +487,8 @@ starfish_draw (Display *dpy, Window window, void *closure) s = reset_starfish (st); else s = make_window_starfish (st); + + st->starfish = s; } } @@ -489,6 +499,10 @@ static void 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 @@ -510,6 +524,7 @@ starfish_free (Display *dpy, Window window, void *closure) static const char *starfish_defaults [] = { ".background: black", ".foreground: white", + "*fpsSolid: true", "*delay: 10000", "*thickness: 0", /* pixels, 0 = random */ "*rotation: -1", /* degrees, -1 = "random" */ @@ -517,6 +532,9 @@ static const char *starfish_defaults [] = { "*duration: 30", "*delay2: 5", "*mode: random", +#ifdef USE_IPHONE + "*ignoreRotation: True", +#endif 0 };