http://ftp.x.org/contrib/applications/xscreensaver-3.06.tar.gz
[xscreensaver] / hacks / maze.c
index 2593f235dad23be6df40b8f27a368a6dc5cfe9f3..40edf41b58bf9e8dfdc310585680c9b963d037a2 100644 (file)
@@ -35,7 +35,7 @@
  *              Added bridge option.
  * modified:  [ 8-11-95 ] Ed James <james@mml.mmc.com>
  *              added fill of dead-end box to solve_maze while loop.
- * modified:  [ 3-7-93 ]  Jamie Zawinski <jwz@netscape.com>
+ * modified:  [ 3-7-93 ]  Jamie Zawinski <jwz@jwz.org>
  *             added the XRoger logo, cleaned up resources, made
  *             grid size a parameter.
  * modified:  [ 3-3-93 ]  Jim Randell <jmr@mddjmr.fc.hp.com>
@@ -201,6 +201,9 @@ check_events (void)                        /* X event handler [ rhess ] */
     case Expose:
       restart = 1;
       break;
+    default:
+      screenhack_handle_event(dpy, &e);
+      break;
     }
     return(1);
   }
@@ -1367,13 +1370,13 @@ find_dead_regions(void)
          }
        }
       }
-    XSync(dpy, 0);
+    XSync(dpy, False);
 }
 
 static void
 solve_maze (void)                     /* solve it with graphical feedback */
 {
-    int i, dir, from, x, y, ways, bt;
+    int i, dir, from, x, y, ways, bt = 0;
 
     /* plug up the surrounding wall */
     maze[end_x][end_y] |= (WALL_TOP >> end_dir);
@@ -1533,7 +1536,7 @@ enter_square (int n)                      /* move into a neighboring square */
 
 
 /*
- *  jmr additions for Jamie Zawinski's <jwz@netscape.com> screensaver stuff,
+ *  jmr additions for Jamie Zawinski's <jwz@jwz.org> screensaver stuff,
  *  note that the code above this has probably been hacked about in some
  *  arbitrary way.
  */
@@ -1612,7 +1615,13 @@ screenhack(Display *display, Window window)
   set_maze_sizes (xgwa.width, xgwa.height);
 
   if (! root)
-    XSelectInput (dpy, win, ExposureMask|ButtonPressMask|StructureNotifyMask);
+    {
+      XWindowAttributes xgwa;
+      XGetWindowAttributes (dpy, window, &xgwa);
+      XSelectInput (dpy, win,
+                    xgwa.your_event_mask | ExposureMask |
+                    ButtonPressMask |StructureNotifyMask);
+    }
   
   gc  = XCreateGC(dpy, win, 0, 0);
   cgc = XCreateGC(dpy, win, 0, 0);