зеркало из https://github.com/mozilla/pjs.git
Bug 53029 - Menu highlight by ALT key should be cleared by next key event
Windows-specific changes to match behavior when a key is pressed that is not a valid access key. r=pink, sr=hyatt
This commit is contained in:
Родитель
9951d7c6ff
Коммит
934c7a8822
|
@ -58,6 +58,10 @@
|
|||
#include "nsMenuPopupFrame.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#ifdef XP_WIN
|
||||
#include "nsISound.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
|
@ -278,6 +282,17 @@ nsMenuBarFrame::FindMenuWithShortcut(PRUint32 aLetter)
|
|||
}
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
}
|
||||
|
||||
// didn't find a matching menu item
|
||||
#ifdef XP_WIN
|
||||
// behavior on Windows - this item is on the menu bar, beep and deactivate the menu bar
|
||||
nsCOMPtr<nsISound> soundInterface = do_CreateInstance("@mozilla.org/sound;1");
|
||||
if (soundInterface)
|
||||
soundInterface->Beep();
|
||||
|
||||
DismissChain();
|
||||
#endif // #ifdef XP_WIN
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
|
|
@ -1217,8 +1217,15 @@ nsMenuFrame::Escape(PRBool& aHandledFlag)
|
|||
NS_IMETHODIMP
|
||||
nsMenuFrame::Enter()
|
||||
{
|
||||
if ( IsDisabled() )
|
||||
if (IsDisabled()) {
|
||||
#ifdef XP_WIN
|
||||
// behavior on Windows - close the popup chain
|
||||
if (mMenuParent)
|
||||
mMenuParent->DismissChain();
|
||||
#endif // #ifdef XP_WIN
|
||||
// this menu item was disabled - exit
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!mMenuOpen) {
|
||||
// The enter key press applies to us.
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
#include "nsIFrameManager.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIRootBox.h"
|
||||
#ifdef XP_WIN
|
||||
#include "nsISound.h"
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
|
||||
|
@ -1500,6 +1503,15 @@ nsMenuPopupFrame::FindMenuWithShortcut(PRUint32 aLetter)
|
|||
}
|
||||
currFrame->GetNextSibling(&currFrame);
|
||||
}
|
||||
|
||||
// didn't find a matching menu item
|
||||
#ifdef XP_WIN
|
||||
// behavior on Windows - this item is in a popup, beep and do nothing else
|
||||
nsCOMPtr<nsISound> soundInterface = do_CreateInstance("@mozilla.org/sound;1");
|
||||
if (soundInterface)
|
||||
soundInterface->Beep();
|
||||
#endif // #ifdef XP_WIN
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче