[vlc-commits] macosx: work-around a playlist core limitation, which doesn' t allow the UI to set the currently displayed root properly, so triggering a play can lead to unwanted results (close #7484)

Felix Paul Kühne git at videolan.org
Tue Sep 18 11:58:57 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Sep 18 11:58:23 2012 +0200| [722c751deddeb6106ed18e379a1364ed85cd2f86] | committer: Felix Paul Kühne

macosx: work-around a playlist core limitation, which doesn't allow the UI to set the currently displayed root properly, so triggering a play can lead to unwanted results (close #7484)

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

 modules/gui/macosx/CoreInteraction.m |   25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index 60ca702..a1c9bad 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -76,17 +76,24 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
 
 - (void)play
 {
-    playlist_t * p_playlist = pl_Get(VLCIntf);
-    bool empty;
-
-    PL_LOCK;
-    empty = playlist_IsEmpty(p_playlist);
-    PL_UNLOCK;
+    input_thread_t * p_input;
+    p_input = pl_CurrentInput(VLCIntf);
+    if (p_input) {
+        var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE);
+        vlc_object_release(p_input);
+    } else {
+        playlist_t * p_playlist = pl_Get(VLCIntf);
+        bool empty;
 
-    if (empty)
-        [[[VLCMain sharedInstance] open] openFileGeneric];
+        PL_LOCK;
+        empty = playlist_IsEmpty(p_playlist);
+        PL_UNLOCK;
 
-    var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE);
+        if ([[[VLCMain sharedInstance] playlist] isSelectionEmpty] && ([[[VLCMain sharedInstance] playlist] currentPlaylistRoot] == p_playlist->p_local_category || [[[VLCMain sharedInstance] playlist] currentPlaylistRoot] == p_playlist->p_ml_category))
+            [[[VLCMain sharedInstance] open] openFileGeneric];
+        else
+            [[[VLCMain sharedInstance] playlist] playItem:nil];
+    }
 }
 
 - (void)pause



More information about the vlc-commits mailing list