http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.14.tar.gz
[xscreensaver] / hacks / zoom.c
index f6cb4b9c5b41e2c2daf6540b946cef6bc11cf0af..eb34ee37972d10b28fdebd6556922021ecf6d6ee 100644 (file)
@@ -99,16 +99,22 @@ static void init_hack(Display *dpy, Window window)
     gcflags |= GCSubwindowMode;
   window_gc = XCreateGC(dpy, window, gcflags, &gcv);
 
-  grab_screen_image(xgwa.screen, window);
-  if (lenses) {
-    orig_map = NULL;
-    pm = XCreatePixmap(dpy, window, sizex, sizey, xgwa.depth);
-    XCopyArea(dpy, window, pm, window_gc, 0, 0, sizex, sizey, 0, 0);
-  } else {
-    orig_map = XGetImage(dpy, window, 0, 0, sizex, sizey, ~0L, ZPixmap);
+
+  orig_map = NULL;
+  pm = XCreatePixmap(dpy, window, sizex, sizey, xgwa.depth);
+  load_random_image (xgwa.screen, window, pm, NULL);
+
+  if (!lenses) {
+    orig_map = XGetImage(dpy, pm, 0, 0, sizex, sizey, ~0L, ZPixmap);
+    XFreePixmap(dpy, pm);
     pm = 0;
   }
 
+  /* We might have needed this to grab the image, but if we leave this set
+     to GCSubwindowMode, then we'll *draw* right over subwindows too. */
+  XSetSubwindowMode (dpy, window_gc, ClipByChildren);
+
+
   XFillRectangle(dpy, window, window_gc, 0, 0, sizex, sizey);
   XSetWindowBackground(dpy, window, bg);
 
@@ -181,7 +187,7 @@ XrmOptionDescRec options[] = {
   { "-pixwidth", ".pixwidth", XrmoptionSepArg, 0 },
   { "-pixheight", ".pixheight", XrmoptionSepArg, 0 },
   { "-pixspacex", ".pixspacex", XrmoptionSepArg, 0 },
-  { "-pixspacey", ".pixspacex", XrmoptionSepArg, 0 },
+  { "-pixspacey", ".pixspacey", XrmoptionSepArg, 0 },
   { "-lensoffsetx", ".lensoffsetx", XrmoptionSepArg, 0 },
   { "-lensoffsety", ".lensoffsety", XrmoptionSepArg, 0 },
   { 0, 0, 0, 0 }