there is handedness at both the initial condition and the transition rule.
*/
+#ifndef HAVE_JWXYZ
+# define DO_STIPPLE
+#endif
+
#ifdef STANDALONE
-#define MODE_loop
-#define PROGCLASS "loop"
-#define HACK_INIT init_loop
-#define HACK_DRAW draw_loop
-#define loop_opts xlockmore_opts
-#define DEFAULTS "*delay: 100000 \n" \
- "*count: -5 \n" \
- "*cycles: 1600 \n" \
- "*size: -12 \n" \
- "*ncolors: 15 \n" \
- "*neighbors: 0 \n"
-#define UNIFORM_COLORS
-#include "xlockmore.h" /* in xscreensaver distribution */
+# define MODE_loop
+# define DEFAULTS "*delay: 100000 \n" \
+ "*count: -5 \n" \
+ "*cycles: 1600 \n" \
+ "*size: -12 \n" \
+ "*ncolors: 15 \n" \
+ "*fpsSolid: true \n" \
+ "*ignoreRotation: True \n" \
+
+# define UNIFORM_COLORS
+# include "xlockmore.h" /* in xscreensaver distribution */
#else /* STANDALONE */
-#include "xlock.h" /* in xlockmore distribution */
+# include "xlock.h" /* in xlockmore distribution */
#endif /* STANDALONE */
#include "automata.h"
{"-neighbors num", "squares 4 or hexagons 6"}
};
-ModeSpecOpt loop_opts =
+ENTRYPOINT ModeSpecOpt loop_opts =
{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc};
gc = MI_GC(mi);
XSetForeground(MI_DISPLAY(mi), gc, lp->colors[state]);
} else {
+#ifdef DO_STIPPLE
gcv.stipple = lp->pixmaps[state];
+#endif /* DO_STIPPLE */
gcv.foreground = MI_WHITE_PIXEL(mi);
gcv.background = MI_BLACK_PIXEL(mi);
XChangeGC(MI_DISPLAY(mi), lp->stippledGC,
- GCStipple | GCForeground | GCBackground, &gcv);
+#ifdef DO_STIPPLE
+ GCStipple |
+#endif /* DO_STIPPLE */
+ GCForeground | GCBackground, &gcv);
gc = lp->stippledGC;
}
fillcell(mi, gc, col, row);
gc = MI_GC(mi);
XSetForeground(display, gc, lp->colors[state]);
} else {
+#ifdef DO_STIPPLE
gcv.stipple = lp->pixmaps[state];
+#endif /* DO_STIPPLE */
gcv.foreground = MI_WHITE_PIXEL(mi);
gcv.background = MI_BLACK_PIXEL(mi);
XChangeGC(display, lp->stippledGC,
- GCStipple | GCForeground | GCBackground, &gcv);
+#ifdef DO_STIPPLE
+ GCStipple |
+#endif /* DO_STIPPLE */
+ GCForeground | GCBackground, &gcv);
gc = lp->stippledGC;
}
(void) free((void *) rects);
}
free_state(lp, state);
- XFlush(display);
return True;
}
init_adam(ModeInfo * mi)
{
loopstruct *lp = &loops[MI_SCREEN(mi)];
- XPoint start, dirx, diry;
+ XPoint start = { 0, 0 }, dirx = { 0, 0 }, diry = { 0, 0 };
int i, j, dir;
#ifdef DELAYDEBUGLOOP
}
}
-void
-release_loop(ModeInfo * mi)
+ENTRYPOINT void
+release_loop (ModeInfo * mi)
{
if (loops != NULL) {
int screen;
static void *stop_warning_about_triangleUnit_already;
-void
-init_loop(ModeInfo * mi)
+ENTRYPOINT void
+init_loop (ModeInfo * mi)
{
Display *display = MI_DISPLAY(mi);
- Window window = MI_WINDOW(mi);
int i, size = MI_SIZE(mi);
loopstruct *lp;
- XGCValues gcv;
stop_warning_about_triangleUnit_already = (void *) &triangleUnit;
lp->redrawing = 0;
+#ifdef DO_STIPPLE
if ((MI_NPIXELS(mi) < COLORS) && (lp->init_bits == 0)) {
- if (lp->stippledGC == None) {
+ Window window = MI_WINDOW(mi);
+ XGCValues gcv;
+ if (lp->stippledGC == None) {
gcv.fill_style = FillOpaqueStippled;
if ((lp->stippledGC = XCreateGC(display, window,
GCFillStyle, &gcv)) == None) {
LOOPBITS(stipples[8], STIPPLESIZE, STIPPLESIZE);
LOOPBITS(stipples[10], STIPPLESIZE, STIPPLESIZE);
}
+#endif /* DO_STIPPLE */
if (MI_NPIXELS(mi) >= COLORS) {
/* Maybe these colors should be randomized */
lp->colors[0] = MI_BLACK_PIXEL(mi);
init_adam(mi);
}
-void
-draw_loop(ModeInfo * mi)
+ENTRYPOINT void
+draw_loop (ModeInfo * mi)
{
int offset, i, j;
unsigned char *z, *znew;
}
}
-void
-refresh_loop(ModeInfo * mi)
+ENTRYPOINT void
+reshape_loop(ModeInfo * mi, int width, int height)
+{
+ XClearWindow (MI_DISPLAY (mi), MI_WINDOW(mi));
+ init_loop (mi);
+}
+
+ENTRYPOINT void
+refresh_loop (ModeInfo * mi)
{
loopstruct *lp;
lp->redrawpos = lp->by * lp->ncols + lp->bx;
}
+ENTRYPOINT Bool
+loop_handle_event (ModeInfo *mi, XEvent *event)
+{
+ if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
+ {
+ reshape_loop (mi, MI_WIDTH(mi), MI_HEIGHT(mi));
+ return True;
+ }
+ return False;
+}
+
+XSCREENSAVER_MODULE ("Loop", loop)
+
#endif /* MODE_loop */