static void Run( intf_thread_t *p_intf )
{
+ sigset_t set;
+
/* Do it again - for some unknown reason, vlc_thread_create() often
* fails to go to real-time priority with the first launched thread
* (???) --Meuuh */
vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW );
+
+ /* Make sure the "force quit" menu item does quit instantly.
+ * VLC overrides SIGTERM which is sent by the "force quit"
+ * menu item to make sure deamon mode quits gracefully, so
+ * we un-override SIGTERM here. */
+ sigemptyset( &set );
+ sigaddset( &set, SIGTERM );
+ pthread_sigmask( SIG_UNBLOCK, &set, NULL );
+
[[VLCMain sharedInstance] setIntf: p_intf];
[NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
return YES;
}
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
+{
+ /* Check for update silently on startup */
+ if ( !nib_update_loaded )
+ nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner:self];
+
+ 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
application */
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
[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
/* write cached user defaults to disk */
[[NSUserDefaults standardUserDefaults] synchronize];
- p_intf->b_die = VLC_TRUE;
+ vlc_object_kill( p_intf );
/* Go back to Run() and make libvlc exit properly */
longjmp( jmpbuffer, 1 );
- (IBAction)checkForUpdate:(id)sender
{
if ( !nib_update_loaded )
- {
nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner:self];
- [o_update showUpdateWindow];
- } else {
- [o_update showUpdateWindow];
- }
+
+ [o_update showUpdateWindow];
}
- (IBAction)openReadMe:(id)sender