[vlc-devel] commit: macosx: Define playlist_IsStopped(), and make sure it returns the very next state. Fix #1674. ( Hitting the button stop on Mac OS X interface doesn't close the vout window .) (Pierre d'Herbemont )

git version control git at videolan.org
Mon Jul 7 00:04:13 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Mon Jul  7 00:06:21 2008 +0200| [ab915f9988bd01e3b9d5ec25a19f9006d2040f8d]

macosx: Define playlist_IsStopped(), and make sure it returns the very next state. Fix #1674. (Hitting the button stop on Mac OS X interface doesn't close the vout window.)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ab915f9988bd01e3b9d5ec25a19f9006d2040f8d
---

 include/vlc_playlist.h      |    6 +++++-
 modules/gui/macosx/vout.m   |    9 +++++++--
 modules/gui/macosx/voutgl.m |    3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 2490a13..39e464c 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -417,7 +417,11 @@ static inline int playlist_Import( playlist_t *p_playlist, const char *psz_file)
 
 
 /** Tell if the playlist is currently running */
-#define playlist_IsPlaying( pl ) ( pl->status.i_status == PLAYLIST_RUNNING )
+#define playlist_IsPlaying( pl ) ( pl->status.i_status == PLAYLIST_RUNNING && \
+            !(pl->request.b_request && pl->request.i_status == PLAYLIST_STOPPED) )
+
+#define playlist_IsStopped( pl ) ( pl->status.i_status == PLAYLIST_STOPPED || \
+            (pl->request.b_request && pl->request.i_status == PLAYLIST_STOPPED) )
 
 /** Tell if the playlist is empty */
 #define playlist_IsEmpty( pl ) ( pl->items.i_size == 0 )
diff --git a/modules/gui/macosx/vout.m b/modules/gui/macosx/vout.m
index 4fde1d1..a59b6f6 100644
--- a/modules/gui/macosx/vout.m
+++ b/modules/gui/macosx/vout.m
@@ -984,10 +984,15 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 - (void)closeVout
 {
     playlist_t * p_playlist = pl_Yield( VLCIntf );
+    PL_LOCK;
+    bool stopped = playlist_IsStopped( p_playlist );
+    PL_UNLOCK;
 
-    if(!playlist_IsPlaying( p_playlist ))
+    if(stopped)
         [o_window performSelectorOnMainThread: @selector(orderOut:) withObject: self waitUntilDone: YES];
- 
+    else
+        msg_Dbg( VLCIntf, "we are not closing the window, playlist is playing" );
+
     vlc_object_release( p_playlist );
 
     [super closeVout];
diff --git a/modules/gui/macosx/voutgl.m b/modules/gui/macosx/voutgl.m
index cfcdaf0..8625617 100644
--- a/modules/gui/macosx/voutgl.m
+++ b/modules/gui/macosx/voutgl.m
@@ -200,6 +200,9 @@ int OpenVideoGL  ( vlc_object_t * p_this )
 void CloseVideoGL ( vlc_object_t * p_this )
 {
     vout_thread_t * p_vout = (vout_thread_t *) p_this;
+
+    msg_Dbg( p_this, "Closing" );
+
     if( p_vout->p_sys->b_embedded )
     {
         aglDestroyContext(p_vout->p_sys->agl_ctx);




More information about the vlc-devel mailing list