Commit 8fe16309 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fix crash when trying to use the video menu

parent 8018c67d
...@@ -423,11 +423,16 @@ ...@@ -423,11 +423,16 @@
- (IBAction)showPosition: (id)sender - (IBAction)showPosition: (id)sender
{ {
vout_thread_t *p_vout = input_GetVout( pl_CurrentInput( VLCIntf )); input_thread_t * p_input = pl_CurrentInput( VLCIntf );
if( p_vout != NULL ) if( p_input != NULL )
{ {
var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_POSITION ); vout_thread_t *p_vout = input_GetVout( p_input );
vlc_object_release( (vlc_object_t *)p_vout ); if( p_vout != NULL )
{
var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_POSITION );
vlc_object_release( (vlc_object_t *)p_vout );
}
vlc_object_release( p_input );
} }
} }
...@@ -448,54 +453,58 @@ ...@@ -448,54 +453,58 @@
- (IBAction)windowAction:(id)sender - (IBAction)windowAction:(id)sender
{ {
NSString *o_title = [sender title]; NSString *o_title = [sender title];
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
vout_thread_t *p_vout = input_GetVout( pl_CurrentInput( VLCIntf )); if( p_input != NULL )
if( p_vout != NULL )
{ {
id o_vout_view = [self voutView]; vout_thread_t *p_vout = input_GetVout( p_input );
if( o_vout_view ) if( p_vout != NULL )
{ {
if( [o_title isEqualToString: _NS("Half Size") ] ) id o_vout_view = [self voutView];
[o_vout_view scaleWindowWithFactor: 0.5 animate: YES]; if( o_vout_view )
else if( [o_title isEqualToString: _NS("Normal Size") ] )
[o_vout_view scaleWindowWithFactor: 1.0 animate: YES];
else if( [o_title isEqualToString: _NS("Double Size") ] )
[o_vout_view scaleWindowWithFactor: 2.0 animate: YES];
else if( [o_title isEqualToString: _NS("Float on Top") ] )
[o_vout_view toggleFloatOnTop];
else if( [o_title isEqualToString: _NS("Fit to Screen") ] )
{ {
id o_window = [o_vout_view voutWindow]; if( [o_title isEqualToString: _NS("Half Size") ] )
if( ![o_window isZoomed] ) [o_vout_view scaleWindowWithFactor: 0.5 animate: YES];
[o_window performZoom:self]; else if( [o_title isEqualToString: _NS("Normal Size") ] )
} [o_vout_view scaleWindowWithFactor: 1.0 animate: YES];
else if( [o_title isEqualToString: _NS("Snapshot") ] ) else if( [o_title isEqualToString: _NS("Double Size") ] )
{ [o_vout_view scaleWindowWithFactor: 2.0 animate: YES];
[o_vout_view snapshot]; else if( [o_title isEqualToString: _NS("Float on Top") ] )
[o_vout_view toggleFloatOnTop];
else if( [o_title isEqualToString: _NS("Fit to Screen") ] )
{
id o_window = [o_vout_view voutWindow];
if( ![o_window isZoomed] )
[o_window performZoom:self];
}
else if( [o_title isEqualToString: _NS("Snapshot") ] )
{
[o_vout_view snapshot];
}
else
{
/* Fullscreen state for next time will be saved here too */
[o_vout_view toggleFullscreen];
}
} }
else vlc_object_release( (vlc_object_t *)p_vout );
}
else
{
playlist_t * p_playlist = pl_Hold( VLCIntf );
if( [o_title isEqualToString: _NS("Fullscreen")] ||
[sender isKindOfClass:[NSButton class]] )
{ {
/* Fullscreen state for next time will be saved here too */ vlc_value_t val;
[o_vout_view toggleFullscreen]; var_Get( p_playlist, "fullscreen", &val );
var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool );
} }
}
vlc_object_release( (vlc_object_t *)p_vout );
}
else
{
playlist_t * p_playlist = pl_Hold( VLCIntf );
if( [o_title isEqualToString: _NS("Fullscreen")] || pl_Release( VLCIntf );
[sender isKindOfClass:[NSButton class]] )
{
vlc_value_t val;
var_Get( p_playlist, "fullscreen", &val );
var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool );
} }
vlc_object_release( p_input );
pl_Release( VLCIntf );
} }
} }
- (IBAction)telxTransparent:(id)sender - (IBAction)telxTransparent:(id)sender
...@@ -612,26 +621,31 @@ ...@@ -612,26 +621,31 @@
if( key ) if( key )
{ {
vout_thread_t *p_vout = input_GetVout( pl_CurrentInput( VLCIntf )); input_thread_t * p_input = pl_CurrentInput( VLCIntf );
if( p_input != NULL )
if( p_vout != NULL )
{ {
/* Escape */ vout_thread_t *p_vout = input_GetVout( p_input );
if( key == (unichar) 0x1b )
if( p_vout != NULL )
{ {
id o_vout_view = [self voutView]; /* Escape */
if( o_vout_view && [o_vout_view isFullscreen] ) if( key == (unichar) 0x1b )
{ {
[o_vout_view toggleFullscreen]; id o_vout_view = [self voutView];
if( o_vout_view && [o_vout_view isFullscreen] )
{
[o_vout_view toggleFullscreen];
eventHandled = YES;
}
}
else if( key == ' ' )
{
[self play:self];
eventHandled = YES; eventHandled = YES;
} }
vlc_object_release( (vlc_object_t *)p_vout );
} }
else if( key == ' ' ) vlc_object_release( p_input );
{
[self play:self];
eventHandled = YES;
}
vlc_object_release( (vlc_object_t *)p_vout );
} }
} }
return eventHandled; return eventHandled;
...@@ -986,9 +1000,8 @@ ...@@ -986,9 +1000,8 @@
else if( [[o_mi title] isEqualToString: _NS("Previous")] || else if( [[o_mi title] isEqualToString: _NS("Previous")] ||
[[o_mi title] isEqualToString: _NS("Next")] ) [[o_mi title] isEqualToString: _NS("Next")] )
{ {
/** \todo fix i_size use */
PL_LOCK; PL_LOCK;
bEnabled = p_playlist->items.i_size > 1; bEnabled = playlist_CurrentSize( p_playlist ) > 1;
PL_UNLOCK; PL_UNLOCK;
} }
else if( [[o_mi title] isEqualToString: _NS("Random")] ) else if( [[o_mi title] isEqualToString: _NS("Random")] )
...@@ -1041,27 +1054,31 @@ ...@@ -1041,27 +1054,31 @@
NSEnumerator *o_enumerator = [o_windows objectEnumerator]; NSEnumerator *o_enumerator = [o_windows objectEnumerator];
bEnabled = FALSE; bEnabled = FALSE;
vout_thread_t *p_vout = input_GetVout( pl_CurrentInput( VLCIntf )); if( p_input != NULL )
if( p_vout != NULL )
{ {
if( [[o_mi title] isEqualToString: _NS("Float on Top")] ) vout_thread_t *p_vout = input_GetVout( p_input );
if( p_vout != NULL )
{ {
var_Get( p_vout, "video-on-top", &val ); if( [[o_mi title] isEqualToString: _NS("Float on Top")] )
[o_mi setState: val.b_bool ? NSOnState : NSOffState];
}
while( (o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCVoutWindow"] ||
[[[VLCMain sharedInstance] embeddedList]
windowContainsEmbedded: o_window])
{ {
bEnabled = TRUE; var_Get( p_vout, "video-on-top", &val );
break; [o_mi setState: val.b_bool ? NSOnState : NSOffState];
} }
while( (o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCVoutWindow"] ||
[[[VLCMain sharedInstance] embeddedList]
windowContainsEmbedded: o_window])
{
bEnabled = TRUE;
break;
}
}
vlc_object_release( (vlc_object_t *)p_vout );
} }
vlc_object_release( p_input );
vlc_object_release( (vlc_object_t *)p_vout );
} }
if( [[o_mi title] isEqualToString: _NS("Fullscreen")] ) if( [[o_mi title] isEqualToString: _NS("Fullscreen")] )
{ {
......
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