X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fhopalong.c;h=d3cc7df0cbdc5461f9e20ec0ddd263d21295c2c0;hb=39809ded547bdbb08207d3e514950425215b4410;hp=f97f54bd0d7d86d762999436593d96ac75db7231;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/hopalong.c b/hacks/hopalong.c index f97f54bd..d3cc7df0 100644 --- a/hacks/hopalong.c +++ b/hacks/hopalong.c @@ -55,12 +55,15 @@ static const char sccsid[] = "@(#)hop.c 5.00 2000/11/01 xlockmore"; #define DEFAULTS "*delay: 10000 \n" \ "*count: 1000 \n" \ "*cycles: 2500 \n" \ - "*ncolors: 200 \n" + "*ncolors: 200 \n" \ + "*fpsSolid: true \n" \ + "*ignoreRotation: True \n" \ + # define SMOOTH_COLORS # define reshape_hop 0 +# define release_hop 0 # define hop_handle_event 0 # include "xlockmore.h" /* in xscreensaver distribution */ -# include "erase.h" #else /* STANDALONE */ # include "xlock.h" /* in xlockmore distribution */ #endif /* STANDALONE */ @@ -150,8 +153,8 @@ ENTRYPOINT ModeSpecOpt hop_opts = #ifdef USE_MODULES ModStruct hop_description = -{"hop", "init_hop", "draw_hop", "release_hop", - "refresh_hop", "init_hop", (char *) NULL, &hop_opts, +{"hop", "init_hop", "draw_hop", (char *) NULL, + "refresh_hop", "init_hop", "free_hop", &hop_opts, 10000, 1000, 2500, 1, 64, 1.0, "", "Shows real plane iterated fractals", 0, NULL}; @@ -184,9 +187,6 @@ typedef struct { int count; int bufsize; XPoint *pointBuffer; /* pointer for XDrawPoints */ -#ifdef STANDALONE - eraser_state *eraser; -#endif } hopstruct; static hopstruct *hops = (hopstruct *) NULL; @@ -199,11 +199,7 @@ init_hop(ModeInfo * mi) double range; hopstruct *hp; - if (hops == NULL) { - if ((hops = (hopstruct *) calloc(MI_NUM_SCREENS(mi), - sizeof (hopstruct))) == NULL) - return; - } + MI_INIT (mi, hops); hp = &hops[MI_SCREEN(mi)]; hp->centerx = MI_WIDTH(mi) / 2; @@ -386,9 +382,7 @@ init_hop(ModeInfo * mi) return; } -#ifndef STANDALONE MI_CLEARWINDOW(mi); -#endif XSetForeground(display, gc, MI_WHITE_PIXEL(mi)); hp->count = 0; @@ -407,13 +401,6 @@ draw_hop(ModeInfo * mi) return; hp = &hops[MI_SCREEN(mi)]; -#ifdef STANDALONE - if (hp->eraser) { - hp->eraser = erase_window (MI_DISPLAY(mi), MI_WINDOW(mi), hp->eraser); - return; - } -#endif - if (hp->pointBuffer == NULL) return; @@ -542,35 +529,26 @@ draw_hop(ModeInfo * mi) XDrawPoints(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi), hp->pointBuffer, hp->bufsize, CoordModeOrigin); if (++hp->count > MI_CYCLES(mi)) { -#ifdef STANDALONE - hp->eraser = erase_window (MI_DISPLAY(mi), MI_WINDOW(mi), hp->eraser); -#endif /* STANDALONE */ init_hop(mi); } } ENTRYPOINT void -release_hop(ModeInfo * mi) +free_hop(ModeInfo * mi) { - if (hops != NULL) { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { - hopstruct *hp = &hops[screen]; + hopstruct *hp = &hops[MI_SCREEN(mi)]; - if (hp->pointBuffer != NULL) - (void) free((void *) hp->pointBuffer); - } - (void) free((void *) hops); - hops = (hopstruct *) NULL; - } + if (hp->pointBuffer != NULL) + (void) free((void *) hp->pointBuffer); } +#ifndef STANDALONE ENTRYPOINT void refresh_hop(ModeInfo * mi) { MI_CLEARWINDOW(mi); } +#endif XSCREENSAVER_MODULE_2 ("Hopalong", hopalong, hop)