Hi all,

I have this problem where CGDisplayFade fails every fifth or so time
it is called, and I don't see why. What fails is usually fading in,
but also out from time to time. As you can see in the code below I
wait for the fade to complete in the fadeOut method, update the window
content and then wait an additional half a second before attempting to
fade in again, just to be on the safe side. In my fadeIn method I also
wait for the fade to complete before moving on. Any idea what the
problem is, or more generally what can cause this failure?

Thanks.
/ f.


- (void) aMethod
{
      [self fadeOut];
      // update window content here
      [self performSelector:@selector(fadeIn) withObject:nil afterDelay:0.5];
}

- (void) fadeOut
{       

        // token = CGDisplayFadeReservationToken instance variable
        CGDisplayErr err =
CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval,
                                                                                
&token);
                                                                                
        if (err == kCGErrorSuccess) {
                CGDisplayFade (token, 0.5, kCGDisplayBlendNormal,
                kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, true);
        } else {
                NSLog(@"fade out error");
        }       
                
}

- (void) fadeIn
{       
        CGDisplayErr err = CGDisplayFade (token, 0.5, kCGDisplayBlendSolidColor,
          kCGDisplayBlendNormal, 0.0, 0.0, 0.0, true);
        
        if (err == kCGErrorSuccess)
                CGReleaseDisplayFadeReservation (token);
        else {
                NSLog(@"fade in error");
        }
}
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to