projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-5.01.tar.gz
[xscreensaver]
/
hacks
/
attraction.c
diff --git
a/hacks/attraction.c
b/hacks/attraction.c
index 0f0e5e73a8f01ca7287dd16c57152a51c6acef8a..8e25d244f1d11aa3544de2c9a4cb7486be218637 100644
(file)
--- a/
hacks/attraction.c
+++ b/
hacks/attraction.c
@@
-729,12
+729,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 */
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) )
(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);
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);