vlc/vlc-2.2 | branch: master | David Fuhrmann <[email protected]> | Tue 
Jan  3 17:37:41 2017 +0100| [be33cf9b764b352fb45df1d90eeaaadba42d1f4a] | 
committer: David Fuhrmann

macosx: Select correct table view item if playlist is in background

If playlist is in background, the data model is not correctly
initialized yet and thus the item is not found. Workaround by
selecting the last index which is always the newly playing item.
This is a hack, but the data model in VLC 2.2.x is broken by design
and is fixed already in VLC 3.0.

Closes #17570

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

 modules/gui/macosx/playlist.m | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 2b652c6..a64f3c1 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -684,6 +684,11 @@
 
     id o_item = [o_outline_dict objectForKey:[NSString stringWithFormat: 
@"%p", p_item]];
     NSInteger i_index = [o_outline_view rowForItem:o_item];
+    if (i_index == -1) {
+        i_index = [o_outline_view numberOfRows] - 1;
+        msg_Dbg(VLCIntf, "Cannot find playing item, assuming last one with 
index %ld", (long)i_index);
+    }
+
     [o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:i_index] 
byExtendingSelection:NO];
     [o_outline_view setNeedsDisplay:YES];
 }

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to