From http://www.jwz.org/xscreensaver/xscreensaver-5.38.tar.gz
[xscreensaver] / hacks / galaxy.c
index f060591c0eed2a8b6d930d9d21db7caf57e1f63d..3a6e1f78582c08671210d80cb6de507696cfdfb1 100644 (file)
@@ -43,8 +43,13 @@ static const char sccsid[] = "@(#)galaxy.c 4.04 97/07/28 xlockmore";
 # define DEFAULTS      "*delay:  20000  \n"   \
                                        "*count:  -5     \n"   \
                                        "*cycles:  250   \n"   \
-                                       "*ncolors:  64   \n"
+                                       "*ncolors:  64   \n" \
+                                       "*fpsSolid:  true   \n" \
+                                       "*ignoreRotation: True \n" \
+                                   "*lowrez: True \n" \
+
 # define UNIFORM_COLORS
+# define release_galaxy 0
 # define reshape_galaxy 0
 # define galaxy_handle_event 0
 # include "xlockmore.h"    /* from the xscreensaver distribution */
@@ -156,9 +161,10 @@ x-axis */
 
 static unistruct *universes = NULL;
 
-static void
-free_galaxies(unistruct * gp)
+ENTRYPOINT void
+free_galaxy(ModeInfo * mi)
 {
+ unistruct  *gp = &universes[MI_SCREEN(mi)];
  if (gp->galaxies != NULL) {
   int         i;
 
@@ -190,7 +196,7 @@ startover(ModeInfo * mi)
  gp->rot_x = 0;
 
  if (MI_BATCHCOUNT(mi) < -MINGALAXIES)
-  free_galaxies(gp);
+  free_galaxy(mi);
  gp->ngalaxies = MI_BATCHCOUNT(mi);
  if (gp->ngalaxies < -MINGALAXIES)
   gp->ngalaxies = NRAND(-gp->ngalaxies - MINGALAXIES + 1) + MINGALAXIES;
@@ -305,14 +311,10 @@ init_galaxy(ModeInfo * mi)
 {
  unistruct  *gp;
 
- if (universes == NULL) {
-  if ((universes = (unistruct *) calloc(MI_NUM_SCREENS(mi),
-      sizeof (unistruct))) == NULL)
-   return;
- }
+ MI_INIT (mi, universes);
  gp = &universes[MI_SCREEN(mi)];
 
-# ifdef HAVE_COCOA     /* Don't second-guess Quartz's double-buffering */
+# ifdef HAVE_JWXYZ     /* Don't second-guess Quartz's double-buffering */
   dbufp = False;
 # endif
 
@@ -438,23 +440,12 @@ draw_galaxy(ModeInfo * mi)
     startover(mi);
 }
 
-ENTRYPOINT void
-release_galaxy(ModeInfo * mi)
-{
- if (universes != NULL) {
-  int         screen;
-
-  for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++)
-   free_galaxies(&universes[screen]);
-  (void) free((void *) universes);
-  universes = NULL;
- }
-}
-
+#ifndef STANDALONE
 ENTRYPOINT void
 refresh_galaxy(ModeInfo * mi)
 {
  /* Do nothing, it will refresh by itself */
 }
+#endif
 
 XSCREENSAVER_MODULE ("Galaxy", galaxy)