Commit e34ebba5 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

Mac OS X gui: Pause playback when going to sleep.

parent aefd2b47
......@@ -745,6 +745,10 @@ static VLCMain *_o_sharedMainInstance = nil;
if([o_update shouldCheckForUpdate])
[NSThread detachNewThreadSelector:@selector(checkForUpdate) toTarget:o_update withObject:NULL];
/* Handle sleep notification */
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(computerWillSleep:)
name:NSWorkspaceWillSleepNotification object:nil];
}
/* Listen to the remote in exclusive mode, only when VLC is the active
......@@ -758,6 +762,18 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_remote stopListening: self];
}
/* Triggered when the computer goes to sleep */
- (void)computerWillSleep: (NSNotification *)notification
{
/* Pause */
if ( p_intf->p_sys->i_play_status == PLAYING_S )
{
vlc_value_t val;
val.i_int = config_GetInt( p_intf, "key-play-pause" );
var_Set( p_intf->p_libvlc, "key-pressed", val );
}
}
/* Helper method for the remote control interface in order to trigger forward/backward and volume
increase/decrease as long as the user holds the left/right, plus/minus button */
- (void) executeHoldActionForRemoteButton: (NSNumber*) buttonIdentifierNumber
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment