http://www.jwz.org/xscreensaver/xscreensaver-5.12.tar.gz
[xscreensaver] / hacks / eruption.c
index 2084cbf27bc77cfd150c57f5d44f2c806e4cbab1..03b9645ecf48b9153bf544fb363dcd07ecaf04ef 100644 (file)
@@ -116,6 +116,7 @@ static void Execute( struct state *st )
          else if (st->particles[i].xpos >= st->iWinWidth - 2)
            {
              st->particles[i].xpos = st->iWinWidth - 2;
+             if (st->particles[i].xpos < 1) st->particles[i].xpos = 1;
              st->particles[i].xdir = -st->particles[i].xdir + 4;
              st->particles[i].colorindex = st->iColorCount;
            }
@@ -129,9 +130,11 @@ static void Execute( struct state *st )
          else if (st->particles[i].ypos >= st->iWinHeight - 3)
            {
              st->particles[i].ypos = st->iWinHeight- 3;
+             if (st->particles[i].ypos < 1) st->particles[i].ypos = 1;
              st->particles[i].ydir = (-st->particles[i].ydir >> 2) - (random() % 2);
              st->particles[i].colorindex = st->iColorCount;
            }
+
          
          /* st->gravity kicks in */
          st->particles[i].ydir += st->gravity;
@@ -140,6 +143,7 @@ static void Execute( struct state *st )
          st->particles[i].colorindex--;
          
          /* draw particle */
+         if (st->iWinHeight <= 2 || st->iWinWidth <= 2) continue;
          st->fire[st->particles[i].ypos][st->particles[i].xpos] = st->particles[i].colorindex;
          st->fire[st->particles[i].ypos][st->particles[i].xpos - 1] = st->particles[i].colorindex;
          st->fire[st->particles[i].ypos + 1][st->particles[i].xpos] = st->particles[i].colorindex;
@@ -294,7 +298,7 @@ static void Initialize( struct state *st )
 {
        XGCValues gcValues;
        XWindowAttributes XWinAttribs;
-       int iBitsPerPixel, i;
+       int /*iBitsPerPixel,*/ i;
 
        /* Create the Image for drawing */
        XGetWindowAttributes( st->dpy, st->window, &XWinAttribs );
@@ -306,7 +310,7 @@ static void Initialize( struct state *st )
                for( i=0; i<pfvc; i++ )
                        if( pfv[ i ].depth == XWinAttribs.depth )
                        {
-                               iBitsPerPixel = pfv[ i ].bits_per_pixel;
+                               /*iBitsPerPixel = pfv[ i ].bits_per_pixel;*/
                                break;
                        }
                if( pfv )
@@ -342,7 +346,6 @@ eruption_init (Display *dpy, Window window)
        time_t nTime = time( NULL );
        unsigned short iFrame = 0;
 #endif  /*  VERBOSE */
-        int i;
 
   st->dpy = dpy;
   st->window = window;
@@ -393,7 +396,6 @@ eruption_init (Display *dpy, Window window)
 
        st->delay = get_integer_resource(st->dpy,  "delay", "Integer" );
        st->cycles = get_integer_resource(st->dpy,  "cycles", "Integer" );
-       i = st->cycles;
 
        cache(st);
        
@@ -474,6 +476,7 @@ eruption_free (Display *dpy, Window window, void *closure)
 static const char *eruption_defaults [] = {
   ".background: black",
   ".foreground: white",
+  "*fpsTop:    true",
   "*cycles:   80",
   "*ncolors:  256",
   "*delay:    10000",