http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.01.tar.gz
[xscreensaver] / hacks / shadebobs.c
index 670d667750f6abd2e445212f7dc1634913edc2bd..d0942bcf4395b1b0e845cbc621a8d664197a6b32 100644 (file)
@@ -45,6 +45,8 @@
 char *progclass = "ShadeBobs";
 
 char *defaults [] = {
+  ".background: black",
+  ".foreground: white",
   "*degrees:  0",      /* default: Automatic degree calculation */
   "*color:    random",
   "*count:    4",
@@ -384,13 +386,17 @@ void screenhack(Display *pDisplay, Window Win )
 
                if( i++ >= cycles )
                {
+                        XWindowAttributes XWinAttribs;
+                        XGetWindowAttributes( pDisplay, Win, &XWinAttribs );
+
                        i = 0;
-                       XClearWindow( pDisplay, Win );
                        memset( pImage->data, 0, pImage->bytes_per_line * pImage->height );
                        for( iShadeBob=0; iShadeBob<nShadeBobCount; iShadeBob++ )
                                ResetShadeBob( &aShadeBobs[ iShadeBob ] );
+                        XFreeColors( pDisplay, XWinAttribs.colormap, aiColorVals, iColorCount, 0 );
                        free( aiColorVals );
                        aiColorVals = SetPalette( pDisplay, Win, sColor, &iColorCount );
+                        XClearWindow( pDisplay, Win );
                }
 
                for( iShadeBob=0; iShadeBob<nShadeBobCount; iShadeBob++ )