Skip to content

Commit fa6dfc5

Browse files
committed
Merge pull request adobe#188 from adobe/glenn/menu-sections
Add another position hack to let users to insert menu with "first" position on Mac.
2 parents ef4358b + d5d734c commit fa6dfc5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

appshell/appshell_extensions_mac.mm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,13 @@ int32 AddMenu(CefRefPtr<CefBrowser> browser, ExtensionString itemTitle, Extensio
728728

729729
NSInteger positionIdx = -1;
730730
int32 errCode = getNewMenuPosition(browser, nil, position, relativeId, positionIdx);
731+
732+
// Another position hack. If position is "first" we will change positionIdx to 1
733+
// since we can't allow user to put anything before the Mac OS default application menu.
734+
if (position.size() > 0 && position == "first" && positionIdx == 0) {
735+
positionIdx = 1;
736+
}
737+
731738
if (positionIdx > -1) {
732739
[[NSApp mainMenu] insertItem:testItem atIndex:positionIdx];
733740
} else {

0 commit comments

Comments
 (0)