From http://www.jwz.org/xscreensaver/xscreensaver-5.38.tar.gz
[xscreensaver] / hacks / julia.c
index a121711d423aad4dce911732e6305519e1888f52..7311ce72023e777351c8ef6482322b0661e3832f 100644 (file)
@@ -46,6 +46,8 @@ static const char sccsid[] = "@(#)julia.c     4.03 97/04/10 xlockmore";
                                        "*ignoreRotation: True   \n" \
 
 # define UNIFORM_COLORS
+# define release_julia 0
+# define reshape_julia 0
 # include "xlockmore.h"                                /* in xscreensaver distribution */
 #else  /* !STANDALONE */
 # include "xlock.h"                                    /* in xlockmore distribution */
@@ -161,11 +163,7 @@ init_julia(ModeInfo * mi)
        XGCValues   gcv;
        int         i;
 
-       if (julias == NULL) {
-               if ((julias = (juliastruct *) calloc(MI_NUM_SCREENS(mi),
-                                             sizeof (juliastruct))) == NULL)
-                       return;
-       }
+       MI_INIT (mi, julias);
        jp = &julias[MI_SCREEN(mi)];
 
        jp->centerx = MI_WIN_WIDTH(mi) / 2;
@@ -254,13 +252,6 @@ init_julia(ModeInfo * mi)
 }
 
 
-static void
-reshape_julia (ModeInfo *mi, int w, int h)
-{
-  init_julia (mi);
-}
-
-
 ENTRYPOINT Bool
 julia_handle_event (ModeInfo *mi, XEvent *event)
 {
@@ -415,36 +406,29 @@ draw_julia (ModeInfo * mi)
 }
 
 ENTRYPOINT void
-release_julia (ModeInfo * mi)
+free_julia (ModeInfo * mi)
 {
-       if (julias != NULL) {
-               int         screen;
-
-               for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) {
-                       Display    *display = MI_DISPLAY(mi);
-                       juliastruct *jp = &julias[screen];
-                       int         buffer;
-
-                       if (jp->pointBuffer) {
-                               for (buffer = 0; buffer < jp->nbuffers; buffer++)
-                                       if (jp->pointBuffer[buffer])
-                                               (void) free((void *) jp->pointBuffer[buffer]);
-                               (void) free((void *) jp->pointBuffer);
-                       }
-                       if (jp->stippledGC != None)
-                               XFreeGC(display, jp->stippledGC);
-                       if (jp->pixmap != None)
-                               XFreePixmap(display, jp->pixmap);
+       Display    *display = MI_DISPLAY(mi);
+       juliastruct *jp = &julias[MI_SCREEN(mi)];
+       int         buffer;
+
+       if (jp->pointBuffer) {
+               for (buffer = 0; buffer < jp->nbuffers; buffer++)
+                       if (jp->pointBuffer[buffer])
+                               (void) free((void *) jp->pointBuffer[buffer]);
+               (void) free((void *) jp->pointBuffer);
+       }
+       if (jp->stippledGC != None)
+               XFreeGC(display, jp->stippledGC);
+       if (jp->pixmap != None)
+               XFreePixmap(display, jp->pixmap);
 #ifndef HAVE_JWXYZ
-                       if (jp->cursor)
-                         XFreeCursor (display, jp->cursor);
+       if (jp->cursor)
+         XFreeCursor (display, jp->cursor);
 #endif
-               }
-               (void) free((void *) julias);
-               julias = NULL;
-       }
 }
 
+#ifndef STANDALONE
 ENTRYPOINT void
 refresh_julia (ModeInfo * mi)
 {
@@ -453,5 +437,6 @@ refresh_julia (ModeInfo * mi)
        jp->redrawing = 1;
        jp->redrawpos = 0;
 }
+#endif
 
 XSCREENSAVER_MODULE ("Julia", julia)