#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 hop_handle_event 0
+# define release_hop 0
# include "xlockmore.h" /* in xscreensaver distribution */
# include "erase.h"
#else /* STANDALONE */
#ifdef USE_MODULES
ModStruct hop_description =
-{"hop", "init_hop", "draw_hop", "release_hop",
+{"hop", "init_hop", "draw_hop", (char *) NULL,
"refresh_hop", "init_hop", (char *) NULL, &hop_opts,
10000, 1000, 2500, 1, 64, 1.0, "",
"Shows real plane iterated fractals", 0, NULL};
static hopstruct *hops = (hopstruct *) NULL;
+static void free_hop(ModeInfo * mi);
+
ENTRYPOINT void
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, free_hop);
hp = &hops[MI_SCREEN(mi)];
hp->centerx = MI_WIDTH(mi) / 2;
#ifdef STANDALONE
if (hp->eraser) {
hp->eraser = erase_window (MI_DISPLAY(mi), MI_WINDOW(mi), hp->eraser);
+ if (!hp->eraser)
+ init_hop(mi);
return;
}
#endif
if (++hp->count > MI_CYCLES(mi)) {
#ifdef STANDALONE
hp->eraser = erase_window (MI_DISPLAY(mi), MI_WINDOW(mi), hp->eraser);
-#endif /* STANDALONE */
+#else /* !STANDALONE */
init_hop(mi);
+#endif
}
}
-ENTRYPOINT void
-release_hop(ModeInfo * mi)
+static void
+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);
}
ENTRYPOINT void
MI_CLEARWINDOW(mi);
}
+ENTRYPOINT Bool
+hop_handle_event (ModeInfo *mi, XEvent *event)
+{
+ if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
+ {
+ MI_CLEARWINDOW(mi);
+ init_hop (mi);
+ return True;
+ }
+ return False;
+}
+
+
+
XSCREENSAVER_MODULE_2 ("Hopalong", hopalong, hop)
#endif /* MODE_hop */