http://www.jwz.org/xscreensaver/xscreensaver-5.12.tar.gz
[xscreensaver] / hacks / flow.c
index 6f60d1d35243b621d38a4b74a0a3b59a3863a769..a2c819916bc98ec32b5b780022bb1e9d71484373 100644 (file)
@@ -8,7 +8,7 @@ static const char sccsid[] = "@(#)flow.c        5.00 2000/11/01 xlockmore";
 #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:
@@ -98,25 +98,15 @@ static const char sccsid[] = "@(#)flow.c    5.00 2000/11/01 xlockmore";
 
 #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" \
-                                       "*rotate:       True \n" \
-                                       "*ride:         True \n" \
-                                       "*box:          True \n" \
-                                       "*periodic:     True \n" \
-                                       "*search:       True \n" \
-                                       "*dbuf:         True \n"
+                                       "*count:       3000  \n" \
+                                       "*size:        -10   \n" \
+                                       "*cycles:      10000 \n" \
+                                       "*ncolors:     200   \n"
+
+# define reshape_flow 0
+# define flow_handle_event 0
 # 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 */
@@ -170,7 +160,7 @@ static OptionStruct desc[] = {
     {"-/+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};
 
@@ -632,8 +622,8 @@ clip(double nx, double ny, double nz, double d, dvector *s, dvector *e)
  * Public functions
  */
 
-void
-init_flow(ModeInfo * mi)
+ENTRYPOINT void
+init_flow (ModeInfo * mi)
 {
        flowstruct *sp;
        char       *name;
@@ -790,6 +780,10 @@ init_flow(ModeInfo * mi)
                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);
@@ -826,8 +820,8 @@ init_flow(ModeInfo * mi)
        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;
@@ -842,6 +836,10 @@ draw_flow(ModeInfo * mi)
        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;
 
@@ -1113,7 +1111,7 @@ draw_flow(ModeInfo * mi)
                                   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;
                        }
                        
@@ -1203,8 +1201,8 @@ draw_flow(ModeInfo * mi)
        }
 }
 
-void
-release_flow(ModeInfo * mi)
+ENTRYPOINT void
+release_flow (ModeInfo * mi)
 {
        if (flows != NULL) {
                int         screen;
@@ -1216,10 +1214,12 @@ release_flow(ModeInfo * mi)
        }
 }
 
-void
-refresh_flow(ModeInfo * mi)
+ENTRYPOINT void
+refresh_flow (ModeInfo * mi)
 {
        if(!dbufp) MI_CLEARWINDOW(mi);
 }
 
+XSCREENSAVER_MODULE ("Flow", flow)
+
 #endif /* MODE_flow */