зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1181977 - Firefox app menu contains only "Quit" in certain edgecases. r=spohl
This commit is contained in:
Родитель
bb40e2959b
Коммит
d59e2ac8dc
|
@ -28,7 +28,6 @@
|
|||
#include "nsCocoaFeatures.h"
|
||||
#include "nsCocoaUtils.h"
|
||||
#include "nsChildView.h"
|
||||
#include "nsMenuBarX.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "TextInputHandler.h"
|
||||
#include "mozilla/HangMonitor.h"
|
||||
|
@ -658,7 +657,6 @@ nsAppShell::Run(void)
|
|||
mStarted = true;
|
||||
|
||||
AddScreenWakeLockListener();
|
||||
nsMenuBarX::ResetNativeApplicationMenu();
|
||||
|
||||
NS_OBJC_TRY_ABORT([NSApp run]);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ NativeMenuItemTarget* nsMenuBarX::sNativeEventTarget = nil;
|
|||
nsMenuBarX* nsMenuBarX::sLastGeckoMenuBarPainted = nullptr; // Weak
|
||||
nsMenuBarX* nsMenuBarX::sCurrentPaintDelayedMenuBar = nullptr; // Weak
|
||||
NSMenu* sApplicationMenu = nil;
|
||||
BOOL sApplicationMenuIsFallback = NO;
|
||||
BOOL gSomeMenuBarPainted = NO;
|
||||
|
||||
// We keep references to the first quit and pref item content nodes we find, which
|
||||
|
@ -186,6 +187,7 @@ void nsMenuBarX::ConstructFallbackNativeMenus()
|
|||
[quitMenuItem setTarget:nsMenuBarX::sNativeEventTarget];
|
||||
[quitMenuItem setTag:eCommand_ID_Quit];
|
||||
[sApplicationMenu addItem:quitMenuItem];
|
||||
sApplicationMenuIsFallback = YES;
|
||||
}
|
||||
|
||||
uint32_t nsMenuBarX::GetMenuCount()
|
||||
|
@ -207,6 +209,11 @@ nsresult nsMenuBarX::InsertMenuAtIndex(nsMenuX* aMenu, uint32_t aIndex)
|
|||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
// If we've only yet created a fallback global Application menu (using
|
||||
// ContructFallbackNativeMenus()), destroy it before recreating it properly.
|
||||
if (sApplicationMenu && sApplicationMenuIsFallback) {
|
||||
ResetNativeApplicationMenu();
|
||||
}
|
||||
// If we haven't created a global Application menu yet, do it.
|
||||
if (!sApplicationMenu) {
|
||||
nsresult rv = NS_OK; // avoid warning about rv being unused
|
||||
|
@ -506,6 +513,7 @@ void nsMenuBarX::ResetNativeApplicationMenu()
|
|||
[sApplicationMenu removeAllItems];
|
||||
[sApplicationMenu release];
|
||||
sApplicationMenu = nil;
|
||||
sApplicationMenuIsFallback = NO;
|
||||
}
|
||||
|
||||
// Hide the item in the menu by setting the 'hidden' attribute. Returns it in |outHiddenNode| so
|
||||
|
|
Загрузка…
Ссылка в новой задаче