Commit 9adb4abd authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* ALL: there were reports of crashes in the menucode. i think it was that

  the VLCWindow could suddenly disappear (the vout closed) and therefore we
  could no longer reference it. This should fix that. Also made this code
  more generic to avoid code duplication.
parent 84cb5c55
...@@ -20,16 +20,11 @@ ...@@ -20,16 +20,11 @@
ACTIONS = { ACTIONS = {
backward = id; backward = id;
deinterlace = id; deinterlace = id;
doubleWindow = id;
faster = id; faster = id;
floatOnTop = id;
forward = id; forward = id;
fullscreen = id;
halfWindow = id;
loop = id; loop = id;
mute = id; mute = id;
next = id; next = id;
normalWindow = id;
pause = id; pause = id;
play = id; play = id;
prev = id; prev = id;
...@@ -44,6 +39,7 @@ ...@@ -44,6 +39,7 @@
volumeDown = id; volumeDown = id;
volumeSliderUpdated = id; volumeSliderUpdated = id;
volumeUp = id; volumeUp = id;
windowAction = id;
}; };
CLASS = VLCControls; CLASS = VLCControls;
LANGUAGE = ObjC; LANGUAGE = ObjC;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* controls.h: MacOS X interface plugin * controls.h: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: controls.h,v 1.2 2003/05/01 01:11:17 hartman Exp $ * $Id: controls.h,v 1.3 2003/05/06 20:12:28 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -52,11 +52,7 @@ ...@@ -52,11 +52,7 @@
- (IBAction)volumeSliderUpdated:(id)sender; - (IBAction)volumeSliderUpdated:(id)sender;
- (void)updateVolumeSlider; - (void)updateVolumeSlider;
- (IBAction)halfWindow:(id)sender; - (IBAction)windowAction:(id)sender;
- (IBAction)normalWindow:(id)sender;
- (IBAction)doubleWindow:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (IBAction)floatOnTop:(id)sender;
- (IBAction)deinterlace:(id)sender; - (IBAction)deinterlace:(id)sender;
- (IBAction)toggleProgram:(id)sender; - (IBAction)toggleProgram:(id)sender;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* controls.m: MacOS X interface plugin * controls.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: controls.m,v 1.35 2003/05/05 22:04:11 hartman Exp $ * $Id: controls.m,v 1.36 2003/05/06 20:12:28 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -324,79 +324,34 @@ ...@@ -324,79 +324,34 @@
[o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)]; [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
} }
- (IBAction)halfWindow:(id)sender - (IBAction)windowAction:(id)sender
{ {
id o_window = [NSApp keyWindow]; id o_window = [NSApp keyWindow];
NSString *o_title = [sender title];
NSArray *o_windows = [NSApp windows]; NSArray *o_windows = [NSApp windows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator]; NSEnumerator *o_enumerator = [o_windows objectEnumerator];
vout_thread_t *p_vout = vlc_object_find( [NSApp getIntf], VLC_OBJECT_VOUT,
while ((o_window = [o_enumerator nextObject])) FIND_ANYWHERE );
{
if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
[o_window scaleWindowWithFactor: 0.5];
}
}
}
- (IBAction)normalWindow:(id)sender
{
id o_window = [NSApp keyWindow];
NSArray *o_windows = [NSApp windows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator];
while ((o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
[o_window scaleWindowWithFactor: 1];
}
}
}
- (IBAction)doubleWindow:(id)sender
{
id o_window = [NSApp keyWindow];
NSArray *o_windows = [NSApp windows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator];
while ((o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
[o_window scaleWindowWithFactor: 2];
}
}
}
- (IBAction)fullscreen:(id)sender if( p_vout != NULL )
{
id o_window = [NSApp keyWindow];
NSArray *o_windows = [NSApp windows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator];
while ((o_window = [o_enumerator nextObject]))
{ {
if( [[o_window className] isEqualToString: @"VLCWindow"] ) while ((o_window = [o_enumerator nextObject]))
{
[o_window toggleFullscreen];
}
}
}
- (IBAction)floatOnTop:(id)sender
{
id o_window = [NSApp keyWindow];
NSArray *o_windows = [NSApp windows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator];
while ((o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCWindow"] )
{ {
[o_window toggleFloatOnTop]; if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
if( [o_title isEqualToString: _NS("Fullscreen") ] )
[o_window toggleFullscreen];
else if( [o_title isEqualToString: _NS("Half Size") ] )
[o_window scaleWindowWithFactor: 0.5];
else if( [o_title isEqualToString: _NS("Normal Size") ] )
[o_window scaleWindowWithFactor: 1.0];
else if( [o_title isEqualToString: _NS("Double Size") ] )
[o_window scaleWindowWithFactor: 2.0];
else if( [o_title isEqualToString: _NS("Float On Top") ] )
[o_window toggleFloatOnTop];
}
} }
vlc_object_release( (vlc_object_t *)p_vout );
} }
} }
...@@ -734,13 +689,19 @@ ...@@ -734,13 +689,19 @@
[o_mi setState: i_state]; [o_mi setState: i_state];
} }
while ((o_window = [o_enumerator nextObject])) vout_thread_t *p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{ {
if( [[o_window className] isEqualToString: @"VLCWindow"] ) while ((o_window = [o_enumerator nextObject]))
{ {
bEnabled = TRUE; if( [[o_window className] isEqualToString: @"VLCWindow"] )
break; {
bEnabled = TRUE;
break;
}
} }
vlc_object_release( (vlc_object_t *)p_vout );
} }
} }
else if( [[o_mi title] isEqualToString: _NS("Float On Top")] ) else if( [[o_mi title] isEqualToString: _NS("Float On Top")] )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin * intf.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.74 2003/05/05 22:23:39 gbazin Exp $ * $Id: intf.m,v 1.75 2003/05/06 20:12:28 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -636,18 +636,22 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg ) ...@@ -636,18 +636,22 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if( p_intf->p_sys->b_current_title_update ) if( p_intf->p_sys->b_current_title_update )
{ {
id o_vout_wnd; vout_thread_t *p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
NSEnumerator * o_enum = [[NSApp windows] objectEnumerator]; if( p_vout != NULL )
while( ( o_vout_wnd = [o_enum nextObject] ) )
{ {
if( [[o_vout_wnd className] isEqualToString: @"VLCWindow"] ) id o_vout_wnd;
NSEnumerator * o_enum = [[NSApp windows] objectEnumerator];
while( ( o_vout_wnd = [o_enum nextObject] ) )
{ {
[o_vout_wnd updateTitle]; if( [[o_vout_wnd className] isEqualToString: @"VLCWindow"] )
{
[o_vout_wnd updateTitle];
}
} }
vlc_object_release( (vlc_object_t *)p_vout );
} }
[o_playlist updateRowSelection]; [o_playlist updateRowSelection];
[o_info updateInfo]; [o_info updateInfo];
......
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