dock icon's menu doesn't begin with separator anymore
... even when there's no open windows
Change-Id: I8c1d8f254e621d1867a100ad984f8b77ed8cfc5a
Reviewed-on: https://gerrit.libreoffice.org/19677
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm
index 4fd1ee5..e231aac 100644
--- a/sfx2/source/appl/shutdowniconaqua.mm
+++ b/sfx2/source/appl/shutdowniconaqua.mm
@@ -487,9 +487,7 @@ void aqua_init_systray()
if( [NSApp respondsToSelector: @selector(addDockMenuItem:)] )
{
[pDockSubMenu setSubmenu: pDockMenu];
// insert a separator to the dock menu
[NSApp performSelector:@selector(addDockMenuItem:) withObject: [NSMenuItem separatorItem]];
// and now add the submenu
// add the submenu
[NSApp performSelector:@selector(addDockMenuItem:) withObject: pDockSubMenu];
}
else
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 1ce314e..8634ce9 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -114,8 +114,13 @@ AquaSalFrame::~AquaSalFrame()
delete mpGraphics;
if( mpDockMenuEntry )
{
NSMenu* pDock = AquaSalInstance::GetDynamicDockMenu();
// life cycle comment: the menu has ownership of the item, so no release
[AquaSalInstance::GetDynamicDockMenu() removeItem: mpDockMenuEntry];
[pDock removeItem: mpDockMenuEntry];
if ( [[pDock itemAtIndex: 0] isSeparatorItem] )
[pDock removeItemAtIndex: 0];
}
if ( mpNSView ) {
[AquaA11yFactory revokeView: mpNSView];
[mpNSView release];
@@ -298,6 +303,11 @@ void AquaSalFrame::SetTitle(const OUString& rTitle)
if( mpDockMenuEntry == NULL )
{
NSMenu* pDock = AquaSalInstance::GetDynamicDockMenu();
NSMenuItem* pTopItem = [pDock itemAtIndex: 0];
if ( [pTopItem hasSubmenu] )
[pDock insertItem: [NSMenuItem separatorItem] atIndex: 0];
mpDockMenuEntry = [pDock insertItemWithTitle: pTitle
action: @selector(dockMenuItemTriggered:)
keyEquivalent: @""