vlc | branch: master | Thomas Guillem <[email protected]> | Tue Feb 6 16:30:39 2018 +0100| [35e7089a2758aaa8b66aa865bce341860714c6d1] | committer: Thomas Guillem
macosx: renderer: keep selected item Don't remove the selected item when the discoverer is closed (and don't stop the CC session). > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=35e7089a2758aaa8b66aa865bce341860714c6d1 --- modules/gui/macosx/VLCRendererMenuController.m | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/gui/macosx/VLCRendererMenuController.m b/modules/gui/macosx/VLCRendererMenuController.m index 411a5b9125..16514122f6 100644 --- a/modules/gui/macosx/VLCRendererMenuController.m +++ b/modules/gui/macosx/VLCRendererMenuController.m @@ -96,6 +96,17 @@ - (void)addRendererItem:(VLCRendererItem *)item { + // Check if the item is already selected + if (_selectedItem.representedObject != nil) + { + VLCRendererItem *selected_rd_item = _selectedItem.representedObject; + if ([selected_rd_item.identifier isEqualToString:item.identifier]) + { + [_selectedItem setRepresentedObject:item]; + return; + } + } + // Create a menu item NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:item.name action:@selector(selectRenderer:) @@ -110,10 +121,9 @@ NSInteger index = [_rendererMenu indexOfItemWithRepresentedObject:item]; if (index != NSNotFound) { NSMenuItem *menuItem = [_rendererMenu itemAtIndex:index]; - if (menuItem == _selectedItem) { - [self selectRenderer:_rendererNoneItem]; - } - [_rendererMenu removeItemAtIndex:index]; + // Don't remove selected item + if (menuItem != _selectedItem) + [_rendererMenu removeItemAtIndex:index]; } } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
