X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fnoseguy.c;h=970c6d4f25ef349251869d8f4f40fe979b39438f;hb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56;hp=f6502bef5621059f5214e5291c52bf0debcfd939;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/noseguy.c b/hacks/noseguy.c index f6502bef..970c6d4f 100644 --- a/hacks/noseguy.c +++ b/hacks/noseguy.c @@ -1,5 +1,4 @@ -/* xscreensaver, Copyright (c) 1992, 1996, 1997, 1998, 2005, 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 @@ -196,6 +195,17 @@ move (struct state *st) st->move_length = st->Width / 100 + random() % 90, tries = 8; else tries--; + /* There maybe the case that we won't be able to exit from + this routine (especially when the geometry is too small)!! + + Ensure that we can exit from this routine. + */ +#if 1 + if (!tries && (st->move_length <= 1)) { + st->move_length = 1; + break; + } +#endif switch (random() % 8) { case 0: @@ -239,7 +249,8 @@ move (struct state *st) } } while (!st->move_dir); } - walk(st, st->move_dir); + if (st->move_dir) + walk(st, st->move_dir); --st->move_length; st->next_fn = move; } @@ -557,6 +568,7 @@ static const char *noseguy_defaults [] = { ".foreground: #CCCCCC", "*textForeground: black", "*textBackground: #CCCCCC", + "*fpsSolid: true", "*program: xscreensaver-text --cols 40 | head -n15", ".font: -*-new century schoolbook-*-r-*-*-*-180-*-*-*-*-*-*", 0