Commit fca62c49 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: don't use NSNotifcations to handle VLC's dialog callbacks, always...

macosx: don't use NSNotifcations to handle VLC's dialog callbacks, always perform NSAlert and friends on main thread

additionally, removed 2 clients of the manageInterface loop, which will be removed all together shortly
parent 2ac54856
......@@ -78,7 +78,7 @@
}
+ (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;
......
......@@ -68,25 +68,24 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
[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"] )
[self showFatalDialog: o_value];
[self performSelectorOnMainThread:@selector(showFatalDialog:) withObject:o_value waitUntilDone:YES];
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"] )
[self showQuestionDialog: o_value];
[self performSelectorOnMainThread:@selector(showQuestionDialog:) withObject:o_value waitUntilDone:YES];
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"] )
[self showProgressDialog: o_value];
[self performSelectorOnMainThread:@selector(showProgressDialog:) withObject:o_value waitUntilDone:YES];
else
msg_Err( VLCIntf, "unhandled dialog type: '%s'", [o_type UTF8String] );
msg_Err( VLCIntf, "unhandled dialog type: '%s'", type );
}
-(void)showFatalDialog: (NSValue *)o_value
......
......@@ -75,8 +75,6 @@ struct intf_sys_t
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;
......
......@@ -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 )
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;
}
......@@ -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 )
p_intf->p_sys->b_fullscreen_update = true;
NSLog( @"we should update fullscreen state" ); //FIXME
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];
[[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;
......@@ -1374,21 +1381,6 @@ static void manage_cleanup( void * args )
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) )
{
......
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