]> git.sesse.net Git - vlc/commitdiff
*ALL: update the title of the window everytime the stream changes.
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 13 Feb 2003 02:00:56 +0000 (02:00 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 13 Feb 2003 02:00:56 +0000 (02:00 +0000)
modules/gui/macosx/intf.m
modules/gui/macosx/vout.h
modules/gui/macosx/vout.m

index 4b6e4536f834772b68059b8792a3eafb1c55b113..43e55d67f02bbba682c8be55310fdfb6f7e5a491 100644 (file)
@@ -2,7 +2,7 @@
  * intf.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.55 2003/02/13 00:09:51 hartman Exp $
+ * $Id: intf.m,v 1.56 2003/02/13 02:00:56 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -552,6 +552,21 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
         p_intf->p_sys->i_part = 0;
 
         p_playlist->p_input->stream.b_changed = 0;
+        
+        id o_awindow = [NSApp keyWindow];
+        NSArray *o_windows = [NSApp windows];
+        NSEnumerator *o_enumerator = [o_windows objectEnumerator];
+        
+        while ((o_awindow = [o_enumerator nextObject]))
+        {
+            if( [[o_awindow className] isEqualToString: @"VLCWindow"] )
+            {
+                vlc_mutex_unlock( &p_playlist->object_lock );
+                [o_awindow updateTitle];
+                vlc_mutex_lock( &p_playlist->object_lock );
+            }
+        }
+
         msg_Dbg( p_intf, "stream has changed, refreshing interface" );
     }
     else
index 7319cf862c86a0ebe71560827ebf13ce303f9aa5..1bf794df092364e44be8570395c04ae3a86e0567 100644 (file)
@@ -2,7 +2,7 @@
  * vout.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: vout.h,v 1.8 2003/02/08 21:43:26 hartman Exp $
+ * $Id: vout.h,v 1.9 2003/02/13 02:00:56 hartman Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -37,6 +37,7 @@
 - (void)scaleWindowWithFactor: (float)factor;
 - (void)toggleFullscreen;
 - (BOOL)isFullscreen;
+- (void)updateTitle;
 
 - (BOOL)windowShouldClose:(id)sender;
 
index 5038c52b8b9dba315252c067e58efea867856bfd..0ef4c6db30194de8f780fefe248d0a334dd5e0be 100644 (file)
@@ -2,7 +2,7 @@
  * vout.m: MacOS X video output plugin
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: vout.m,v 1.31 2003/02/11 15:35:29 hartman Exp $
+ * $Id: vout.m,v 1.32 2003/02/13 02:00:56 hartman Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -800,6 +800,40 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
     }
 }
 
+- (void)updateTitle
+{
+    NSMutableString *o_title;
+    intf_thread_t * p_intf = [NSApp getIntf];
+    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                               FIND_ANYWHERE );
+    
+    if( p_playlist == NULL )
+    {
+        return;
+    }
+
+    vlc_mutex_lock( &p_playlist->object_lock );
+    o_title = [NSMutableString stringWithUTF8String: 
+        p_playlist->pp_items[p_playlist->i_index]->psz_name]; 
+    vlc_mutex_unlock( &p_playlist->object_lock );
+
+    vlc_object_release( p_playlist );
+
+    if (o_title)
+    {
+        NSRange prefixrange = [o_title rangeOfString: @"file:"];
+        if ( prefixrange.location != NSNotFound )
+            [o_title deleteCharactersInRange: prefixrange];
+
+        [self setTitleWithRepresentedFilename: o_title];
+    }
+    else
+    {
+        [self setTitle:
+            [NSString stringWithCString: VOUT_TITLE " (QuickTime)"]];
+    }
+}
+
 /* This is actually the same as VLCControls::stop. */
 - (BOOL)windowShouldClose:(id)sender
 {
@@ -930,12 +964,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
     VLCView * o_view;
     NSScreen * o_screen;
     vout_thread_t * p_vout;
-    NSMutableString *o_title;
     vlc_bool_t b_main_screen;
-
-    intf_thread_t * p_intf = [NSApp getIntf];
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                               FIND_ANYWHERE );
     
     p_vout = (vout_thread_t *)[o_value pointerValue];
 
@@ -1020,35 +1049,9 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
     [o_view lockFocus];
     p_vout->p_sys->p_qdport = [o_view qdPort];
     [o_view unlockFocus];
-
-
-    if( p_playlist == NULL )
-    {
-        return;
-    }
-
-    vlc_mutex_lock( &p_playlist->object_lock );
-    o_title = [NSMutableString stringWithUTF8String: 
-        p_playlist->pp_items[p_playlist->i_index]->psz_name]; 
-    vlc_mutex_unlock( &p_playlist->object_lock ); 
-
-    vlc_object_release( p_playlist );
-
-    if (o_title)
-    {
-        NSRange prefixrange = [o_title rangeOfString: @"file:"];
-        if ( prefixrange.location != NSNotFound )
-            [o_title deleteCharactersInRange: prefixrange];
-
-        [p_vout->p_sys->o_window setTitleWithRepresentedFilename: o_title];
-        [p_vout->p_sys->o_window makeKeyAndOrderFront: nil];
-    }
-    else
-    {
-        [p_vout->p_sys->o_window setTitle:
-            [NSString stringWithCString: VOUT_TITLE " (QuickTime)"]];
-        [p_vout->p_sys->o_window makeKeyAndOrderFront: nil];
-    }
+    
+    [p_vout->p_sys->o_window updateTitle];
+    [p_vout->p_sys->o_window makeKeyAndOrderFront: nil];
 }
 
 - (void)destroyWindow:(NSValue *)o_value