ALL:
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 13 Feb 2003 14:16:41 +0000 (14:16 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 13 Feb 2003 14:16:41 +0000 (14:16 +0000)
 - when a new stream is being loaded we select the current title in the
   playlist.
 - Cleaned up some of my previous commited code dealing with updating
   the window title.

modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m

index 622b906..e25a46f 100644 (file)
@@ -2,7 +2,7 @@
  * intf.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: intf.h,v 1.26 2003/02/13 00:09:51 hartman Exp $
+ * $Id: intf.h,v 1.27 2003/02/13 14:16:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -68,6 +68,7 @@ struct intf_sys_t
     vlc_bool_t b_intf_update;
     vlc_bool_t b_play_status;
     vlc_bool_t b_playlist_update;
+    vlc_bool_t b_current_title_update;
     
     /* menus handlers */
     vlc_bool_t b_chapter_update;
index 43e55d6..d062ee4 100644 (file)
@@ -2,7 +2,7 @@
  * intf.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.56 2003/02/13 02:00:56 hartman Exp $
+ * $Id: intf.m,v 1.57 2003/02/13 14:16:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -549,24 +549,11 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
         p_intf->p_sys->b_chapter_update = 1;
         p_intf->p_sys->b_audio_update = 1;
         p_intf->p_sys->b_spu_update = 1;
+        p_intf->p_sys->b_current_title_update = 1;
         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
@@ -622,7 +609,6 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
         val.b_bool = 0;
 
         var_Set( (vlc_object_t *)p_playlist, "intf-change", val );
-
         [o_playlist playlistUpdated];
         p_intf->p_sys->b_playlist_update = VLC_FALSE;
     }
@@ -633,6 +619,27 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
     {
         vlc_mutex_lock( &p_input->stream.stream_lock );
     }
+    
+    if( p_intf->p_sys->b_current_title_update )
+    {
+        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 );
+            }
+        }
+        vlc_mutex_unlock( &p_playlist->object_lock );
+        [o_playlist updateState];
+        vlc_mutex_lock( &p_playlist->object_lock );
+        p_intf->p_sys->b_current_title_update = FALSE;
+    }
 
     if( p_intf->p_sys->b_intf_update )
     {
index 2245ac2..2d97487 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: playlist.h,v 1.4 2003/01/20 03:45:06 hartman Exp $
+ * $Id: playlist.h,v 1.5 2003/02/13 14:16:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
@@ -57,5 +57,6 @@
 
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_pos enqueue:(BOOL)b_enqueue;
 - (void)playlistUpdated;
+- (void)updateState;
 
 @end
index 97821d8..4af3cf5 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: playlist.m,v 1.10 2003/02/13 01:14:55 hartman Exp $
+ * $Id: playlist.m,v 1.11 2003/02/13 14:16:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *
     [o_table_view reloadData];
 }
 
+- (void)updateState
+{
+    int i_row;
+
+    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;
+    }
+    
+    i_row = p_playlist->i_index;
+    vlc_object_release( p_playlist );
+    
+    [o_table_view selectRow: i_row byExtendingSelection: NO];
+    [o_table_view scrollRowToVisible: i_row];
+    
+    vout_thread_t * p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
+                                                          FIND_ANYWHERE );
+
+    if ( p_vout == NULL )
+    {
+        [[NSApp keyWindow] makeFirstResponder:o_table_view];
+        return;
+    }
+    else if ( !p_vout->b_fullscreen )
+    {
+        [[NSApp keyWindow] makeFirstResponder:o_table_view];
+    }
+    vlc_object_release( (vlc_object_t *)p_vout );
+}
+
 @end
 
 @implementation VLCPlaylist (NSTableDataSource)