Bug 757330 Don't activate an empty menubar r=Enn

This commit is contained in:
Neil Rashbrook 2012-05-30 08:33:20 +01:00
parent 9bf1a59717
commit a395dd73d3
2 changed files with 8 additions and 6 deletions

View File

@ -150,14 +150,14 @@ nsMenuBarFrame::ToggleMenuActiveState()
if (mCurrentMenu)
mCurrentMenu->SelectMenu(false);
// Activate the menu bar
SetActive(true);
// Set the active menu to be the top left item (e.g., the File menu).
// We use an attribute called "menuactive" to track the current
// active menu.
nsMenuFrame* firstFrame = nsXULPopupManager::GetNextMenuItem(this, nsnull, false);
if (firstFrame) {
// Activate the menu bar
SetActive(true);
#ifdef MOZ_WIDGET_GTK2
firstFrame->OpenMenu(true);
#else

View File

@ -240,11 +240,13 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
mMenuBarFrame->SetActiveByKeyboard();
ToggleMenuActiveState();
if (mMenuBarFrame->IsActive()) {
aKeyEvent->StopPropagation();
aKeyEvent->PreventDefault();
return NS_OK; // consume the event
}
}
}
#endif // !XP_MACOSX
}
}