Commit 9adb4abd authored by hartman's avatar 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 @@
ACTIONS = {
backward = id;
deinterlace = id;
doubleWindow = id;
faster = id;
floatOnTop = id;
forward = id;
fullscreen = id;
halfWindow = id;
loop = id;
mute = id;
next = id;
normalWindow = id;
pause = id;
play = id;
prev = id;
......@@ -44,6 +39,7 @@
volumeDown = id;
volumeSliderUpdated = id;
volumeUp = id;
windowAction = id;
};
CLASS = VLCControls;
LANGUAGE = ObjC;
......
......@@ -2,7 +2,7 @@
* controls.h: MacOS X interface plugin
*****************************************************************************
* 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>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -52,11 +52,7 @@
- (IBAction)volumeSliderUpdated:(id)sender;
- (void)updateVolumeSlider;
- (IBAction)halfWindow:(id)sender;
- (IBAction)normalWindow:(id)sender;
- (IBAction)doubleWindow:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (IBAction)floatOnTop:(id)sender;
- (IBAction)windowAction:(id)sender;
- (IBAction)deinterlace:(id)sender;
- (IBAction)toggleProgram:(id)sender;
......
......@@ -2,7 +2,7 @@
* controls.m: MacOS X interface plugin
*****************************************************************************
* 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>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -324,79 +324,34 @@
[o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
}
- (IBAction)halfWindow:(id)sender
- (IBAction)windowAction:(id)sender
{
id o_window = [NSApp keyWindow];
NSString *o_title = [sender title];
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: 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];
}
}
}
vout_thread_t *p_vout = vlc_object_find( [NSApp getIntf], VLC_OBJECT_VOUT,
FIND_ANYWHERE );
- (IBAction)fullscreen:(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( p_vout != NULL )
{
if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
[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"] )
while ((o_window = [o_enumerator nextObject]))
{
[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 @@
[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;
break;
if( [[o_window className] isEqualToString: @"VLCWindow"] )
{
bEnabled = TRUE;
break;
}
}
vlc_object_release( (vlc_object_t *)p_vout );
}
}
else if( [[o_mi title] isEqualToString: _NS("Float On Top")] )
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* 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>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -636,18 +636,22 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if( p_intf->p_sys->b_current_title_update )
{
id o_vout_wnd;
NSEnumerator * o_enum = [[NSApp windows] objectEnumerator];
while( ( o_vout_wnd = [o_enum nextObject] ) )
vout_thread_t *p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
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_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