#ifdef STANDALONE
#define MODE_hop
-#define PROGCLASS "Hop"
-#define HACK_INIT init_hop
-#define HACK_DRAW draw_hop
-#define hop_opts xlockmore_opts
-#define DEFAULTS "*delay: 10000 \n" \
- "*count: 1000 \n" \
- "*cycles: 2500 \n" \
- "*ncolors: 200 \n"
-#define SMOOTH_COLORS
-#include "xlockmore.h" /* in xscreensaver distribution */
-#include "erase.h"
+#define DEFAULTS "*delay: 10000 \n" \
+ "*count: 1000 \n" \
+ "*cycles: 2500 \n" \
+ "*ncolors: 200 \n" \
+ "*fpsSolid: true \n" \
+ "*ignoreRotation: True \n" \
+
+# define SMOOTH_COLORS
+# define reshape_hop 0
+# define release_hop 0
+# include "xlockmore.h" /* in xscreensaver distribution */
+# include "erase.h"
#else /* STANDALONE */
-#include "xlock.h" /* in xlockmore distribution */
-
+# include "xlock.h" /* in xlockmore distribution */
#endif /* STANDALONE */
#ifdef MODE_hop
{"-/+sine", "turn on/off sine format"}
};
-ModeSpecOpt hop_opts =
+ENTRYPOINT ModeSpecOpt hop_opts =
{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc};
#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};
int count;
int bufsize;
XPoint *pointBuffer; /* pointer for XDrawPoints */
+#ifdef STANDALONE
+ eraser_state *eraser;
+#endif
} hopstruct;
static hopstruct *hops = (hopstruct *) NULL;
-void
+static void free_hop(ModeInfo * mi);
+
+ENTRYPOINT void
init_hop(ModeInfo * mi)
{
Display *display = MI_DISPLAY(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;
return;
}
+#ifndef STANDALONE
MI_CLEARWINDOW(mi);
+#endif
XSetForeground(display, gc, MI_WHITE_PIXEL(mi));
hp->count = 0;
}
-void
+ENTRYPOINT void
draw_hop(ModeInfo * mi)
{
double oldj, oldi;
if (hops == NULL)
return;
hp = &hops[MI_SCREEN(mi)];
+
+#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->pointBuffer == NULL)
return;
xp = hp->pointBuffer;
hp->pointBuffer, hp->bufsize, CoordModeOrigin);
if (++hp->count > MI_CYCLES(mi)) {
#ifdef STANDALONE
- erase_full_window(MI_DISPLAY(mi), MI_WINDOW(mi));
-#endif /* STANDALONE */
+ hp->eraser = erase_window (MI_DISPLAY(mi), MI_WINDOW(mi), hp->eraser);
+#else /* !STANDALONE */
init_hop(mi);
+#endif
}
}
-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);
}
-void
+ENTRYPOINT void
refresh_hop(ModeInfo * mi)
{
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 */