Changeset 1202

Show
Ignore:
Timestamp:
03/07/2010 03:14:22 PM (2 years ago)
Author:
gbooker
Message:

Use a timer to suppress the screen saver instead of disabling it. Also supresses the popups which are otherwise not disabled and cause crashes.

Location:
trunk/CommonMediaPlayer/General Actions
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/CommonMediaPlayer/General Actions/CMPScreenReleaseAction.h

    r1179 r1202  
    2424@interface CMPScreenReleaseAction : NSObject <CMPActionController>{ 
    2525        int             screensaverTimeout; 
     26        NSTimer *activityTimer; 
    2627} 
    2728 
  • trunk/CommonMediaPlayer/General Actions/CMPScreenReleaseAction.m

    r1179 r1202  
    203203@implementation CMPScreenReleaseAction 
    204204 
     205- (id)initWithController:(id <CMPPlayerController>)controller andSettings:(NSDictionary *)settings 
     206{ 
     207        return [super init]; 
     208} 
     209 
     210- (void)dealloc 
     211{ 
     212        [activityTimer invalidate]; 
     213        [super dealloc]; 
     214} 
     215 
     216 
    205217- (BOOL)releaseAllDisplaysWithoutFadeWithError:(NSError **)error 
    206218{  
     
    294306} 
    295307 
    296 - (void)disableScreenSaver 
    297 { 
    298         Class cls = NSClassFromString(@"ATVScreenSaverManager"); 
    299         if(cls != nil) 
    300         { 
    301                 Class cls2 = NSClassFromString(@"ATVSettingsFacade"); 
    302                  
    303                 screensaverTimeout = [[cls2 singleton] screenSaverTimeout]; 
    304                 [[cls2 singleton] setScreenSaverTimeout:-1]; 
    305                 [[cls singleton] _updateActivity:nil]; 
    306         } 
    307         else if(cls == nil) 
    308         { 
    309                 cls = NSClassFromString(@"BRScreenSaverManager"); 
    310                 if(cls != nil) 
    311                 { 
    312                         screensaverTimeout = [[BRSettingsFacade settingsFacade] screenSaverTimeout]; 
    313                         [[BRSettingsFacade settingsFacade] setScreenSaverTimeout:-1]; 
    314                 } 
    315         } 
     308- (void)activityTimerFire 
     309{ 
     310        if([CMPATVVersion usingLeopard]) 
     311                UpdateSystemActivity(UsrActivity); 
     312        [BRBackgroundTaskManager holdOffBackgroundTasks]; 
     313        [[NSNotificationCenter defaultCenter] postNotificationName:@"BRUserActionNotification" object:nil]; 
    316314} 
    317315 
     
    359357} 
    360358 
    361 - (void)resetScreenSaver 
    362 { 
    363         Class cls = NSClassFromString(@"ATVScreenSaverManager"); 
    364         if(cls != nil) 
    365         { 
    366                 Class cls2 = NSClassFromString(@"ATVSettingsFacade"); 
    367                 [[cls2 singleton] setScreenSaverTimeout:screensaverTimeout]; 
    368                 [[cls singleton] _updateActivity:nil]; 
    369         } 
    370         else if(cls == nil) 
    371         { 
    372                 cls = NSClassFromString(@"BRScreenSaverManager"); 
    373                 if(cls != nil) 
    374                 { 
    375                         [[BRSettingsFacade settingsFacade] setScreenSaverTimeout:screensaverTimeout]; 
    376                         [[cls sharedInstance] updateActivity]; 
    377                 } 
    378         }  
    379 } 
    380  
    381 - (id)initWithController:(id <CMPPlayerController>)controller andSettings:(NSDictionary *)settings 
    382 { 
    383         return [super init]; 
    384 } 
    385  
    386359- (BOOL)openWithError:(NSError **)error 
    387360{ 
     
    394367         
    395368        if(success) 
    396                 [self disableScreenSaver]; 
     369        { 
     370                [activityTimer invalidate]; 
     371                activityTimer = [NSTimer scheduledTimerWithTimeInterval:24 target:self selector:@selector(activityTimerFire) userInfo:nil repeats:YES]; 
     372                [self activityTimerFire]; 
     373        } 
    397374         
    398375        return success; 
     
    411388        } 
    412389         
    413         [self resetScreenSaver]; 
     390        [activityTimer invalidate]; 
     391        activityTimer = nil; 
    414392         
    415393        return YES;