#ifdef STANDALONE
# define MODE_mountain
-#define DEFAULTS "*delay: 1000 \n" \
+#define DEFAULTS "*delay: 20000 \n" \
"*count: 30 \n" \
"*cycles: 4000 \n" \
- "*ncolors: 64 \n"
+ "*ncolors: 64 \n" \
+ "*fpsSolid: true \n" \
+
# define SMOOTH_COLORS
-# define reshape_mountain 0
-# define mountain_handle_event 0
+# define release_mountain 0
# include "xlockmore.h" /* in xscreensaver distribution */
#else /* STANDALONE */
# include "xlock.h" /* in xlockmore distribution */
#ifdef USE_MODULES
ModStruct mountain_description =
-{"mountain", "init_mountain", "draw_mountain", "release_mountain",
+{"mountain", "init_mountain", "draw_mountain", (char *) NULL,
"refresh_mountain", "init_mountain", (char *) NULL, &mountain_opts,
1000, 30, 4000, 1, 64, 1.0, "",
"Shows Papo's mountain range", 0, NULL};
mp->stage++;
}
+static void free_mountain (ModeInfo * mi);
+
ENTRYPOINT void
init_mountain (ModeInfo * mi)
{
XGCValues gcv;
mountainstruct *mp;
- if (mountains == NULL) {
- if ((mountains = (mountainstruct *) calloc(MI_NUM_SCREENS(mi),
- sizeof (mountainstruct))) == NULL)
- return;
- }
+ MI_INIT (mi, mountains, free_mountain);
mp = &mountains[MI_SCREEN(mi)];
mp->width = MI_WIDTH(mi);
}
ENTRYPOINT void
-release_mountain (ModeInfo * mi)
+reshape_mountain(ModeInfo * mi, int width, int height)
{
- if (mountains != NULL) {
- int screen;
+ XClearWindow (MI_DISPLAY (mi), MI_WINDOW(mi));
+ init_mountain (mi);
+}
- for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) {
- mountainstruct *mp = &mountains[screen];
- if (mp->stippledGC)
- XFreeGC(MI_DISPLAY(mi), mp->stippledGC);
- }
- (void) free((void *) mountains);
- mountains = (mountainstruct *) NULL;
- }
+static void
+free_mountain (ModeInfo * mi)
+{
+ mountainstruct *mp = &mountains[MI_SCREEN(mi)];
+
+ if (mp->stippledGC)
+ XFreeGC(MI_DISPLAY(mi), mp->stippledGC);
}
ENTRYPOINT void
mp->y = 0;
}
+ENTRYPOINT Bool
+mountain_handle_event (ModeInfo *mi, XEvent *event)
+{
+ if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
+ {
+ init_mountain (mi);
+ return True;
+ }
+ return False;
+}
+
XSCREENSAVER_MODULE ("Mountain", mountain)
#endif /* MODE_mountain */