X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fshadebobs.c;h=d1361dd3aa4f23ed8d460cb3d65f73e7efe9e22d;hb=8afc01a67be4fbf3f1cc0fce9adf01b5289a21c6;hp=72d5aa04f76bb186a04490b89aff8601a6c88cbe;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/shadebobs.c b/hacks/shadebobs.c index 72d5aa04..d1361dd3 100644 --- a/hacks/shadebobs.c +++ b/hacks/shadebobs.c @@ -45,12 +45,16 @@ static const char *shadebobs_defaults [] = { ".background: black", ".foreground: white", + "*fpsSolid: true", "*degrees: 0", /* default: Automatic degree calculation */ "*color: random", "*count: 4", "*cycles: 10", "*ncolors: 64", /* changing this doesn't work particularly well */ - "*delay: 5000", + "*delay: 10000", +#ifdef USE_IPHONE + "*ignoreRotation: True", +#endif 0 }; @@ -143,8 +147,11 @@ static void MoveShadeBob( struct state *st, SShadeBob *pShadeBob ) pShadeBob->nAngle += pShadeBob->nAngleInc; pShadeBob->nAngleDelta -= pShadeBob->nAngleInc; - if( pShadeBob->nAngle >= st->iDegreeCount ) pShadeBob->nAngle -= st->iDegreeCount; - else if( pShadeBob->nAngle < 0 ) pShadeBob->nAngle += st->iDegreeCount; + /* Since it can happen that nAngle < 0 and nAngle + iDegreeCount >= iDegreeCount + on floating point, we set some marginal value. + */ + if( pShadeBob->nAngle + 0.5 >= st->iDegreeCount ) pShadeBob->nAngle -= st->iDegreeCount; + else if( pShadeBob->nAngle < -0.5 ) pShadeBob->nAngle += st->iDegreeCount; if( ( pShadeBob->nAngleInc>0.0F && pShadeBob->nAngleDeltanAngleInc ) || ( pShadeBob->nAngleInc<=0.0F && pShadeBob->nAngleDelta>pShadeBob->nAngleInc ) ) @@ -295,12 +302,13 @@ static void Initialize( struct state *st ) { XGCValues gcValues; XWindowAttributes XWinAttribs; - int iBitsPerPixel; + /*int iBitsPerPixel;*/ /* Create the Image for drawing */ XGetWindowAttributes( st->dpy, st->window, &XWinAttribs ); - /* Find the preferred bits-per-pixel. (jwz) */ +#if 0 + /* Find the preferred bits-per-pixel. (jwz) */ { int i, pfvc = 0; XPixmapFormatValues *pfv = XListPixmapFormats( st->dpy, &pfvc ); @@ -313,6 +321,7 @@ static void Initialize( struct state *st ) if( pfv ) XFree (pfv); } +#endif /* Create the GC. */ st->gc = XCreateGC( st->dpy, st->window, 0, &gcValues ); @@ -343,7 +352,7 @@ static void Initialize( struct state *st ) else if( st->iDegreeCount > 5400 ) st->iDegreeCount = 5400; CreateTables( st, st->iDegreeCount ); #ifdef VERBOSE - printf( "%s: Using a %d degree circle.\n", progname ); + printf( "%s: Using a %d degree circle.\n", progname, st->iDegreeCount ); #endif /* VERBOSE */ /* Get the base color. */ @@ -424,16 +433,6 @@ shadebobs_draw (Display *dpy, Window window, void *closure) for( st->iShadeBob=0; st->iShadeBobnShadeBobCount; st->iShadeBob++ ) Execute( st, &st->aShadeBobs[ st->iShadeBob ] ); -#ifdef VERBOSE - iFrame++; - if( nTime - time( NULL ) ) - { - printf( "%s: %d FPS\n", progname, iFrame ); - nTime = time( NULL ); - iFrame = 0; - } -#endif /* VERBOSE */ - return st->delay; }