http://packetstormsecurity.org/UNIX/admin/xscreensaver-3.28.tar.gz
[xscreensaver] / hacks / maze.c
index 004c9396c92a3ab26bb68f22e2eaaf82aad377f6..cfd212c4f9505a6bd601767be7c1898b2d48eb29 100644 (file)
@@ -84,7 +84,7 @@
 #include "screenhack.h"
 #include "erase.h"
 
-#define XROGER
+#define XSCREENSAVER_LOGO
 
 static int solve_delay, pre_solve_delay, post_solve_delay;
 
@@ -133,7 +133,7 @@ static int solve_delay, pre_solve_delay, post_solve_delay;
 
 static int logo_x, logo_y;
 
-#ifdef XROGER
+#ifdef XSCREENSAVER_LOGO
 # define logo_width  128
 # define logo_height 128
 #else
@@ -1129,10 +1129,16 @@ draw_maze_border (void)                         /* draw the maze outline */
       int x, y;
       unsigned int w, h, bw, d;
       XGetGeometry (dpy, logo_map, &r, &x, &y, &w, &h, &bw, &d);
-      XCopyPlane (dpy, logo_map, win, logo_gc,
-                 0, 0, w, h,
-                 border_x + 3 + grid_width * logo_x,
-                 border_y + 3 + grid_height * logo_y, 1);
+      if (d == 1)
+        XCopyPlane (dpy, logo_map, win, logo_gc,
+                    0, 0, w, h,
+                    border_x + 3 + grid_width * logo_x,
+                    border_y + 3 + grid_height * logo_y, 1);
+      else
+        XCopyArea (dpy, logo_map, win, logo_gc,
+                   0, 0, w, h,
+                   border_x + 3 + grid_width * logo_x,
+                   border_y + 3 + grid_height * logo_y);
     }
   draw_solid_square (start_x, start_y, WALL_TOP >> start_dir, tgc);
   draw_solid_square (end_x, end_y, WALL_TOP >> end_dir, tgc);
@@ -1578,9 +1584,6 @@ char *defaults[] = {
   "*maxLength:  5",
   "*syncDraw:   False",
   "*bridge:     False",
-#ifdef XROGER
-  "*logoColor: red3",
-#endif
   0
 };
 
@@ -1602,8 +1605,8 @@ XrmOptionDescRec options[] = {
   { 0, 0, 0, 0 }
 };
 
-#ifdef XROGER
-extern void skull (Display *, Window, GC, GC, int, int, int, int);
+#ifdef XSCREENSAVER_LOGO
+extern void xscreensaver_logo (Display *,Drawable,Colormap, Bool next_frame_p);
 #endif
 
 void
@@ -1612,7 +1615,7 @@ screenhack(Display *display, Window window)
   Pixmap gray;
   int size, root, generator, this_gen;
   XWindowAttributes xgwa;
-  unsigned long bg, fg, pfg, pbg, lfg, sfg, ufg;
+  unsigned long bg, fg, pfg, pbg, sfg, ufg;
 
   size = get_integer_resource ("gridSize", "Dimension");
   root = get_boolean_resource("root", "Boolean");
@@ -1658,17 +1661,10 @@ screenhack(Display *display, Window window)
 
   bg  = get_pixel_resource ("background","Background", dpy, xgwa.colormap);
   fg  = get_pixel_resource ("foreground","Foreground", dpy, xgwa.colormap);
-  lfg = get_pixel_resource ("logoColor", "Foreground", dpy, xgwa.colormap);
   pfg = get_pixel_resource ("liveColor", "Foreground", dpy, xgwa.colormap);
   pbg = get_pixel_resource ("deadColor", "Foreground", dpy, xgwa.colormap);
   sfg = get_pixel_resource ("skipColor", "Foreground", dpy, xgwa.colormap);
   ufg = get_pixel_resource ("surroundColor", "Foreground", dpy, xgwa.colormap);
-  if (mono_p) lfg = pfg = fg;
-
-  if (lfg == bg)
-    lfg = ((bg == WhitePixel (dpy, DefaultScreen (dpy)))
-          ? BlackPixel (dpy, DefaultScreen (dpy))
-          : WhitePixel (dpy, DefaultScreen (dpy)));
 
   XSetForeground (dpy, gc, fg);
   XSetBackground (dpy, gc, bg);
@@ -1680,7 +1676,7 @@ screenhack(Display *display, Window window)
   XSetBackground (dpy, sgc, bg);
   XSetForeground (dpy, ugc, ufg);
   XSetBackground (dpy, ugc, bg);
-  XSetForeground (dpy, logo_gc, lfg);
+  XSetForeground (dpy, logo_gc, fg);
   XSetBackground (dpy, logo_gc, bg);
   XSetForeground (dpy, erase_gc, bg);
   XSetBackground (dpy, erase_gc, bg);
@@ -1692,23 +1688,14 @@ screenhack(Display *display, Window window)
   XSetStipple (dpy, ugc, gray);
   XSetFillStyle (dpy, ugc, FillOpaqueStippled);
   
-#ifdef XROGER
+#ifdef XSCREENSAVER_LOGO
   {
     int w, h;
-    XGCValues gcv;
-    GC draw_gc, erase_gc;
     /* round up to grid size */
     w = ((logo_width  / grid_width) + 1)  * grid_width;
     h = ((logo_height / grid_height) + 1) * grid_height;
-    logo_map = XCreatePixmap (dpy, win, w, h, 1);
-    gcv.foreground = 1L;
-    draw_gc = XCreateGC (dpy, logo_map, GCForeground, &gcv);
-    gcv.foreground = 0L;
-    erase_gc= XCreateGC (dpy, logo_map, GCForeground, &gcv);
-    XFillRectangle (dpy, logo_map, erase_gc, 0, 0, w, h);
-    skull (dpy, logo_map, draw_gc, erase_gc, 5, 0, w-10, h-10);
-    XFreeGC (dpy, draw_gc);
-    XFreeGC (dpy, erase_gc);
+    logo_map = XCreatePixmap (dpy, win, w, h, xgwa.depth);
+    xscreensaver_logo (dpy, logo_map, xgwa.colormap, False);
   }
 #else
   if  (!(logo_map = XCreateBitmapFromData (dpy, win, logo_bits,