[vlc-commits] macosx: Select correct table view item if playlist is in background

David Fuhrmann git at videolan.org
Tue Jan 3 17:41:25 CET 2017


vlc/vlc-2.2 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Tue Jan  3 17:37:41 2017 +0100| [73a9ec51102289134fa7f718ef19c2f2f66c0387] | 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 my 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=73a9ec51102289134fa7f718ef19c2f2f66c0387
---

 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];
 }



More information about the vlc-commits mailing list