ftp://ftp.swin.edu.au/slackware/slackware-9.1/source/xap/xscreensaver/xscreensaver...
[xscreensaver] / hacks / xlyap.c
index 7557dce35064c6a212aeb027323bd0bb6176a2bc..683c21baa610b7aae8573b3af77bb9d9bddd669d 100644 (file)
@@ -39,7 +39,6 @@
 #include "screenhack.h"
 #include "yarandom.h"
 #include "hsv.h"
-#include "vroot.h"
 
 #include <X11/cursorfont.h> 
 #include <X11/Xutil.h> 
@@ -534,17 +533,13 @@ screenhack (Display *d, Window window)
   canvas = window;
   init_canvas();
 
-  if (window != DefaultRootWindow(dpy))
-    XSelectInput(dpy,canvas,KeyPressMask|ButtonPressMask|ButtonMotionMask|
-                ButtonReleaseMask|ExposureMask|StructureNotifyMask);
   if (displayplanes > 1) {
     init_color();
   } else {
     XQueryColors(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
        Colors, numcolors);
   }
-  pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy),
-                        width, height, DefaultDepth(dpy, screen));
+  pixmap = XCreatePixmap(dpy, window, width, height, xgwa.depth);
   rubber_data.band_cursor = XCreateFontCursor(dpy, XC_hand2);
   CreateXorGC();
   Clear();
@@ -582,6 +577,9 @@ main_event(void)
          break;
            case ButtonRelease:
     EndRubberBand(canvas, &rubber_data, &event);
+         break;
+            default: 
+    screenhack_handle_event (dpy, &event);
          break;
            }
        }
@@ -596,13 +594,13 @@ main_event(void)
 static int
 complyap(void)
 {
-  register i, bindex;
+  int i, bindex;
   double total, prod, x, dx, r;
 
   if (!run)
     return TRUE;
   a += a_inc;
-  if (a >= max_a)
+  if (a >= max_a) {
     if (sendpoint(lyapunov) == TRUE)
       return FALSE;
     else {
@@ -611,6 +609,7 @@ complyap(void)
        save_to_file();
       return TRUE;
     }
+  }
   if (b >= max_b) {
     FlushBuffer();
     if (savefile)
@@ -812,7 +811,7 @@ init_canvas(void)
   * create default, writable, graphics contexts for the canvas.
   */
        for (i=0; i<maxcolor; i++) {
-           Data_GC[i] = XCreateGC(dpy, DefaultRootWindow(dpy),
+           Data_GC[i] = XCreateGC(dpy, canvas,
                (unsigned long) NULL, (XGCValues *) NULL);
            /* set the background to black */
            XSetBackground(dpy,Data_GC[i],BlackPixel(dpy,XDefaultScreen(dpy)));
@@ -1508,8 +1507,7 @@ resize(void)
   XClearWindow(dpy, canvas);
   if (pixmap)
     XFreePixmap(dpy, pixmap);
-  pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy),
-      width, height, DefaultDepth(dpy, screen));
+  pixmap = XCreatePixmap(dpy, canvas, width, height, d);
   a_inc = a_range / (double)width;
   b_inc = b_range / (double)height;
   point.x = -1;
@@ -1690,7 +1688,7 @@ CreateXorGC(void)
   values.foreground = foreground;
   values.line_style = LineSolid;
   values.function = GXxor;
-  RubberGC = XCreateGC(dpy, DefaultRootWindow(dpy),
+  RubberGC = XCreateGC(dpy, canvas,
        GCForeground | GCBackground | GCFunction | GCLineStyle, &values);
 }