macosx: don't use NSNotifcations to handle VLC's dialog callbacks, always perform...
authorFelix Paul Kühne <fkuehne@videolan.org>
Sun, 24 Jul 2011 13:31:59 +0000 (15:31 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Sun, 24 Jul 2011 13:31:59 +0000 (15:31 +0200)
additionally, removed 2 clients of the manageInterface loop, which will be removed all together shortly

modules/gui/macosx/coredialogs.h
modules/gui/macosx/coredialogs.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m

index 66b2f8b..ea3829c 100644 (file)
@@ -78,7 +78,7 @@
 }
 + (VLCCoreDialogProvider *)sharedInstance;
 
 }
 + (VLCCoreDialogProvider *)sharedInstance;
 
--(void)performDialogEvent: (NSNotification *)o_notification;
+-(void)performEventWithObject: (NSValue *)o_value ofType: (const char*)type;
 
 -(void)showFatalDialog: (NSValue *)o_value;
 -(void)showFatalWaitDialog: (NSValue *)o_value;
 
 -(void)showFatalDialog: (NSValue *)o_value;
 -(void)showFatalWaitDialog: (NSValue *)o_value;
index 078d4ba..b42d29d 100644 (file)
@@ -68,25 +68,24 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
     [o_prog_cancel_btn setTitle: _NS("Cancel")];
     [o_prog_bar setUsesThreadedAnimation: YES];
 
     [o_prog_cancel_btn setTitle: _NS("Cancel")];
     [o_prog_bar setUsesThreadedAnimation: YES];
 
-}    
+}
 
 
--(void)performDialogEvent: (NSNotification *)o_notification
+-(void)performEventWithObject: (NSValue *)o_value ofType: (const char*)type
 {
 {
-    NSValue *o_value = [[o_notification userInfo] objectForKey:@"VLCDialogPointer"];
-    NSString *o_type = [[o_notification userInfo] objectForKey:@"VLCDialogType"];
+    NSString *o_type = [NSString stringWithUTF8String:type];
 
     if( [o_type isEqualToString: @"dialog-error"] )
 
     if( [o_type isEqualToString: @"dialog-error"] )
-        [self showFatalDialog: o_value];
+        [self performSelectorOnMainThread:@selector(showFatalDialog:) withObject:o_value waitUntilDone:YES];
     else if( [o_type isEqualToString: @"dialog-critical"] )
     else if( [o_type isEqualToString: @"dialog-critical"] )
-        [self showFatalWaitDialog: o_value];
+        [self performSelectorOnMainThread:@selector(showFatalWaitDialog:) withObject:o_value waitUntilDone:YES];
     else if( [o_type isEqualToString: @"dialog-question"] )
     else if( [o_type isEqualToString: @"dialog-question"] )
-        [self showQuestionDialog: o_value];
+        [self performSelectorOnMainThread:@selector(showQuestionDialog:) withObject:o_value waitUntilDone:YES];
     else if( [o_type isEqualToString: @"dialog-login"] )
     else if( [o_type isEqualToString: @"dialog-login"] )
-        [self showLoginDialog: o_value];
+        [self performSelectorOnMainThread:@selector(showLoginDialog:) withObject:o_value waitUntilDone:YES];
     else if( [o_type isEqualToString: @"dialog-progress-bar"] )
     else if( [o_type isEqualToString: @"dialog-progress-bar"] )
-        [self showProgressDialog: o_value];
+        [self performSelectorOnMainThread:@selector(showProgressDialog:) withObject:o_value waitUntilDone:YES];
     else
     else
-        msg_Err( VLCIntf, "unhandled dialog type: '%s'", [o_type UTF8String] );
+        msg_Err( VLCIntf, "unhandled dialog type: '%s'", type );
 }
 
 -(void)showFatalDialog: (NSValue *)o_value
 }
 
 -(void)showFatalDialog: (NSValue *)o_value
index 57a4edc..37c39e1 100644 (file)
@@ -75,8 +75,6 @@ struct intf_sys_t
     bool b_playlist_update;
     bool b_playmode_update;
     bool b_current_title_update;
     bool b_playlist_update;
     bool b_playmode_update;
     bool b_current_title_update;
-    bool b_fullscreen_update;
-    bool b_intf_show;
 
     /* menus handlers */
     bool b_input_update;
 
     /* menus handlers */
     bool b_input_update;
index 765d36c..161779b 100644 (file)
@@ -248,7 +248,14 @@ static int ShowController( vlc_object_t *p_this, const char *psz_variable,
 {
     intf_thread_t * p_intf = VLCIntf;
     if( p_intf && p_intf->p_sys )
 {
     intf_thread_t * p_intf = VLCIntf;
     if( p_intf && p_intf->p_sys )
-        p_intf->p_sys->b_intf_show = true;
+    {
+        NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
+        if( [[[VLCCoreInteraction sharedInstance] voutView] isFullscreen] && config_GetInt( VLCIntf, "macosx-fspanel" ) )
+            [[[[VLCMain sharedInstance] controls] fspanel] fadeIn];
+        else
+            [[VLCMainWindow sharedInstance] makeKeyAndOrderFront: nil];
+        [o_pool release];
+    }
     return VLC_SUCCESS;
 }
 
     return VLC_SUCCESS;
 }
 
@@ -261,7 +268,7 @@ static int FullscreenChanged( vlc_object_t *p_this, const char *psz_variable,
 {
     intf_thread_t * p_intf = VLCIntf;
     if( p_intf && p_intf->p_sys )
 {
     intf_thread_t * p_intf = VLCIntf;
     if( p_intf && p_intf->p_sys )
-        p_intf->p_sys->b_fullscreen_update = true;
+        NSLog( @"we should update fullscreen state" ); //FIXME
     return VLC_SUCCESS;
 }
 
     return VLC_SUCCESS;
 }
 
@@ -286,7 +293,7 @@ static int DialogCallback( vlc_object_t *p_this, const char *type, vlc_value_t p
     }
 
     NSValue *o_value = [NSValue valueWithPointer:value.p_address];
     }
 
     NSValue *o_value = [NSValue valueWithPointer:value.p_address];
-    [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCNewCoreDialogEventNotification" object:[interface coreDialogProvider] userInfo:[NSDictionary dictionaryWithObjectsAndKeys: o_value, @"VLCDialogPointer", [NSString stringWithUTF8String: type], @"VLCDialogType", nil]];
+    [[VLCCoreDialogProvider sharedInstance] performEventWithObject: o_value ofType: type];
 
     [o_pool release];
     return VLC_SUCCESS;
 
     [o_pool release];
     return VLC_SUCCESS;
@@ -1374,21 +1381,6 @@ static void manage_cleanup( void * args )
         p_intf->p_sys->b_playlist_update = false;
     }
 
         p_intf->p_sys->b_playlist_update = false;
     }
 
-    if( p_intf->p_sys->b_fullscreen_update )
-    {
-        p_intf->p_sys->b_fullscreen_update = false;
-    }
-
-    if( p_intf->p_sys->b_intf_show )
-    {
-        if( [[o_coreinteraction voutView] isFullscreen] && config_GetInt( VLCIntf, "macosx-fspanel" ) )
-            [[o_controls fspanel] fadeIn];
-        else
-            [o_mainwindow makeKeyAndOrderFront: self];
-
-        p_intf->p_sys->b_intf_show = false;
-    }
-
     p_input = pl_CurrentInput( p_intf );
     if( p_input && vlc_object_alive (p_input) )
     {
     p_input = pl_CurrentInput( p_intf );
     if( p_input && vlc_object_alive (p_input) )
     {