http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.00.tar.gz
[xscreensaver] / hacks / distort.c
index 97b4ffe829b1f4d76d72756a79905d4e45e36fb6..ffaaa53e6b186539bfac5a44d77f4a5c8f76bda1 100644 (file)
@@ -113,6 +113,8 @@ static void init_distort(Display *dpy, Window window)
        if (get_boolean_resource("bounce", "Boolean"))
                effect = &move_lense;
 
+       XGetWindowAttributes (dpy, window, &xgwa);
+
        if (effect == NULL && radius == 0 && speed == 0 && number == 0
                && !blackhole && !vortex && !magnify && !reflect) {
 /* if no cmdline options are given, randomly choose one of:
@@ -201,6 +203,9 @@ static void init_distort(Display *dpy, Window window)
                 abort(); break;
                }
 
+        /* but if the window is small, reduce default radius */
+        if (xgwa.width < radius * 8)
+          radius = xgwa.width/8;
        }
 
        if (delay < 0)
@@ -222,7 +227,6 @@ static void init_distort(Display *dpy, Window window)
        if (draw == NULL)
                draw = &plain_draw;
 
-       XGetWindowAttributes (dpy, window, &xgwa);
        black_pixel = BlackPixelOfScreen( xgwa.screen );
 
        gcv.function = GXcopy;