]> git.sesse.net Git - vlc/commitdiff
* ALL: there were reports of crashes in the menucode. i think it was that
authorDerk-Jan Hartman <hartman@videolan.org>
Tue, 6 May 2003 20:12:28 +0000 (20:12 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Tue, 6 May 2003 20:12:28 +0000 (20:12 +0000)
  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.

extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
modules/gui/macosx/controls.h
modules/gui/macosx/controls.m
modules/gui/macosx/intf.m

index 2ae839d42f3c780e5a4cde05fe6d1c045194e392..1dcaa6889187c648a12794bc0809a1a02df7533c 100644 (file)
             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; 
index 0ddfd0046f0f8802bd99acba1cabdd8e740c6e34..9b5231a2a04ed3ae69168d583bd300c5de4805d7 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
index ae77743fdbbcea0c6f7a78dee58f57aa1c98ef8d..9d3437445fed4f76220541e59397924f81a84bd3 100644 (file)
@@ -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>
 - (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;
index 9b52acb0c99d7d539623102f21e585d7bbbb386f..51cc396b79f68edfcf37d6ace60c30c92361b524 100644 (file)
@@ -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>
     [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 );
     }
 }
 
             [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")] )
index f64393dc91f489950dea18b7c3eadb091092eba4..c5d9e4e3abe89737a233a200bd03a64288d2aaf2 100644 (file)
@@ -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];