X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fattraction.c;h=ea85f9ad15066faa8f282cbfd7ae1bfc8187eaf9;hb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56;hp=0f0e5e73a8f01ca7287dd16c57152a51c6acef8a;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/attraction.c b/hacks/attraction.c index 0f0e5e73..ea85f9ad 100644 --- a/hacks/attraction.c +++ b/hacks/attraction.c @@ -1,5 +1,4 @@ -/* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997, 1998, 2001, 2006 - * Jamie Zawinski +/* xscreensaver, Copyright (c) 1992-2008 Jamie Zawinski * * 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",