http://www.jwz.org/xscreensaver/xscreensaver-5.07.tar.gz
[xscreensaver] / hacks / attraction.c
index 0f0e5e73a8f01ca7287dd16c57152a51c6acef8a..ea85f9ad15066faa8f282cbfd7ae1bfc8187eaf9 100644 (file)
@@ -1,5 +1,4 @@
-/* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997, 1998, 2001, 2006
- *  Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1992-2008 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -729,12 +728,17 @@ attraction_draw (Display *dpy, Window window, void *closure)
          if(st->cbounce_p)  /* with correct bouncing */
            {
               /* so long as it's out of range, keep bouncing */
+             /* limit the maximum number to bounce to 4.*/
+             int bounce_allowed = 4;
        
-              while( (st->balls[i].x >= (st->xlim - st->balls[i].size)) ||
+              while( bounce_allowed && (
+                    (st->balls[i].x >= (st->xlim - st->balls[i].size)) ||
                      (st->balls[i].y >= (st->ylim - st->balls[i].size)) ||
                      (st->balls[i].x <= 0) ||
                      (st->balls[i].y <= 0) )
+                    )
                 {
+                  bounce_allowed--;
                   if (st->balls[i].x >= (st->xlim - st->balls[i].size))
                     {
                       st->balls[i].x = (2*(st->xlim - st->balls[i].size) - st->balls[i].x);
@@ -986,6 +990,7 @@ attraction_free (Display *dpy, Window window, void *closure)
 static const char *attraction_defaults [] = {
   ".background:        black",
   ".foreground:        white",
+  "*fpsSolid:  true",
   "*mode:      balls",
   "*graphmode:  none",
   "*points:    0",
@@ -999,7 +1004,7 @@ static const char *attraction_defaults [] = {
   "*maxspeed:  true",
   "*cbounce:   true",
   "*mouse:     false",
-  "*viscosity: 1",
+  "*viscosity: 1.0",
   "*orbit:     false",
   "*colorShift:        3",
   "*segments:  500",