vlc/vlc-3.0 | branch: master | Thomas Guillem <[email protected]> | Tue Feb 6 16:30:39 2018 +0100| [1bd85d06b84bbcd38c8fd09e655e24ed69a839d1] | committer: Jean-Baptiste Kempf
macosx: renderer: keep selected item Don't remove the selected item when the discoverer is closed (and don't stop the CC session). (cherry picked from commit 35e7089a2758aaa8b66aa865bce341860714c6d1) Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=1bd85d06b84bbcd38c8fd09e655e24ed69a839d1 --- 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
