From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / hacks / demon.c
index 947134841ec64482f0c09ccb891418bd9085f842..03ddf1f76087341b741709816c59a8c595442d0c 100644 (file)
@@ -46,7 +46,7 @@ static const char sccsid[] = "@(#)demon.c     5.00 2000/11/01 xlockmore";
   Triangle 3, 9, or 12
 */
 
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
 # define DO_STIPPLE
 #endif
 
@@ -55,12 +55,11 @@ static const char sccsid[] = "@(#)demon.c   5.00 2000/11/01 xlockmore";
 # define DEFAULTS      "*delay:   50000 \n" \
                                        "*count:   0     \n" \
                                        "*cycles:  1000  \n" \
-                                       "*size:    -   \n" \
+                                       "*size:    -30   \n" \
                                        "*ncolors: 64    \n" \
                                        "*fpsSolid: true    \n" \
                                    "*ignoreRotation: True  \n" \
 
-# define demon_handle_event 0
 # define UNIFORM_COLORS
 # include "xlockmore.h"                /* in xscreensaver distribution */
 #else /* STANDALONE */
@@ -229,25 +228,6 @@ addtolist(ModeInfo * mi, int col, int row, unsigned char state)
        return True;
 }
 
-#ifdef DEBUG
-static void
-print_state(ModeInfo * mi, int state)
-{
-       demonstruct *dp = &demons[MI_SCREEN(mi)];
-       CellList   *locallist;
-       int         i = 0;
-
-       locallist = dp->cellList[state];
-       (void) printf("state %d\n", state);
-       while (locallist) {
-               (void) printf("%d       x %d, y %d\n", i,
-                             locallist->pt.x, locallist->pt.y);
-               locallist = locallist->next;
-               i++;
-       }
-}
-
-#endif
 
 static void
 free_state(demonstruct * dp, int state)
@@ -466,7 +446,7 @@ init_demon (ModeInfo * mi)
 #endif /* DO_STIPPLE */
        free_struct(dp);
 
-#ifdef HAVE_COCOA
+#ifdef HAVE_JWXYZ
     jwxyz_XSetAntiAliasing (MI_DISPLAY(mi), MI_GC(mi), False);
 #endif
 
@@ -984,6 +964,19 @@ refresh_demon (ModeInfo * mi)
        dp->redrawpos = 0;
 }
 
+ENTRYPOINT Bool
+demon_handle_event (ModeInfo *mi, XEvent *event)
+{
+  if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
+    {
+      reshape_demon (mi, MI_WIDTH(mi), MI_HEIGHT(mi));
+      return True;
+    }
+  return False;
+}
+
+
+
 XSCREENSAVER_MODULE ("Demon", demon)
 
 #endif /* MODE_demon */