/* flow --- flow of strange bees */
#if 0
-#if !defined( lint ) && !defined( SABER )
static const char sccsid[] = "@(#)flow.c 5.00 2000/11/01 xlockmore";
#endif
-#endif
/*-
- * Copyright (c) 1996 by Tim Auckland <Tim.Auckland@Procket.com>
+ * Copyright (c) 1996 by Tim Auckland <tda10.geo@yahoo.com>
* Incorporating some code from Stephen Davies Copyright (c) 2000
*
* Search code based on techniques described in "Strange Attractors:
#ifdef STANDALONE
# define MODE_flow
-# define PROGCLASS "Flow"
-# define HACK_INIT init_flow
-# define HACK_DRAW draw_flow
-# define flow_opts xlockmore_opts
# define DEFAULTS "*delay: 10000 \n" \
- "*count: 3000 \n" \
- "*size: -10 \n" \
- "*cycles: 10000 \n" \
- "*ncolors: 200 \n" \
+ "*count: 3000 \n" \
+ "*size: -10 \n" \
+ "*cycles: 10000 \n" \
+ "*ncolors: 200 \n"
# include "xlockmore.h" /* in xscreensaver distribution */
-# ifndef MI_DEPTH
-# define MI_DEPTH MI_WIN_DEPTH
-# endif
#else /* STANDALONE */
# include "xlock.h" /* in xlockmore distribution */
#endif /* STANDALONE */
{"-/+dbuf", "turn on/off double buffering."},
};
-ModeSpecOpt flow_opts =
+ENTRYPOINT ModeSpecOpt flow_opts =
{sizeof opts / sizeof opts[0], opts,
sizeof vars / sizeof vars[0], vars, desc};
* Public functions
*/
-void
-init_flow(ModeInfo * mi)
+ENTRYPOINT void
+init_flow (ModeInfo * mi)
{
flowstruct *sp;
char *name;
free_flow(sp);
sp->beecount = MI_COUNT(mi);
- if (sp->beecount < 0) { /* random variations */
+ if (!sp->beecount) {
+ sp->beecount = 1; /* The camera requires 1 or more */
+ } else if (sp->beecount < 0) { /* random variations */
sp->beecount = NRAND(-sp->beecount) + 1; /* Minimum 1 */
}
+# ifdef HAVE_COCOA /* Don't second-guess Quartz's double-buffering */
+ dbufp = False;
+# endif
+
if(dbufp) { /* Set up double buffer */
if (sp->buffer != None)
XFreePixmap(MI_DISPLAY(mi), sp->buffer);
allocate(sp->csegs, XSegment,
(sp->beecount + BOX_L) * MI_NPIXELS(mi) * sp->taillen);
allocate(sp->cnsegs, int, MI_NPIXELS(mi));
- allocate(sp->old_segs, XSegment, sp->beecount * sp->taillen);
+ allocate(sp->old_segs, XSegment, (sp->beecount + BOX_L) * sp->taillen);
allocate(sp->p, dvector, sp->beecount * sp->taillen);
}
Z(1, 0) = sp->cam[1].z = 0;
}
-void
-draw_flow(ModeInfo * mi)
+ENTRYPOINT void
+draw_flow (ModeInfo * mi)
{
int b, i;
int col, begin, end;
if (sp->csegs == NULL)
return;
+#ifdef HAVE_COCOA /* Don't second-guess Quartz's double-buffering */
+ XClearWindow (MI_DISPLAY(mi), MI_WINDOW(mi));
+#endif
+
/* multiplier for indexing segment arrays. Used in IX macro, etc. */
segindex = (sp->beecount + BOX_L) * sp->taillen;
are ok, they help to outline the Poincare'
slice. */
for(j = i; j < end; j++) Y(j,b) = Y(i,b);
- begin = i + 1;
+ /*begin = i + 1;*/
break;
}
}
}
-void
-release_flow(ModeInfo * mi)
+ENTRYPOINT void
+reshape_flow(ModeInfo * mi, int width, int height)
+{
+ init_flow (mi);
+}
+
+
+ENTRYPOINT void
+release_flow (ModeInfo * mi)
{
if (flows != NULL) {
int screen;
}
}
-void
-refresh_flow(ModeInfo * mi)
+ENTRYPOINT void
+refresh_flow (ModeInfo * mi)
{
if(!dbufp) MI_CLEARWINDOW(mi);
}
+ENTRYPOINT Bool
+flow_handle_event (ModeInfo *mi, XEvent *event)
+{
+ if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
+ {
+ init_flow (mi);
+ return True;
+ }
+ return False;
+}
+
+
+XSCREENSAVER_MODULE ("Flow", flow)
+
#endif /* MODE_flow */