diff --git a/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp b/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp index 721b761d75b..da6938630ca 100644 --- a/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp @@ -215,8 +215,12 @@ nsMenuBarFrame::FindMenuWithShortcut(PRUint32 aLetter) shortcutKey.ToUpperCase(); if (shortcutKey.Length() > 0) { // We've got something. - PRUnichar shortcutChar = shortcutKey.CharAt(0); - if (shortcutChar == aLetter) { + char tempChar[2]; + tempChar[0] = aLetter; + tempChar[1] = 0; + nsAutoString tempChar2 = tempChar; + + if (shortcutKey.EqualsIgnoreCase(tempChar2)) { // We match! nsCOMPtr menuFrame = do_QueryInterface(currFrame); if (menuFrame) diff --git a/mozilla/layout/xul/base/src/nsMenuBarListener.cpp b/mozilla/layout/xul/base/src/nsMenuBarListener.cpp index 2d4008612bf..ab6ce3125ef 100644 --- a/mozilla/layout/xul/base/src/nsMenuBarListener.cpp +++ b/mozilla/layout/xul/base/src/nsMenuBarListener.cpp @@ -98,6 +98,38 @@ nsMenuBarListener::KeyUp(nsIDOMEvent* aKeyEvent) return NS_OK; // means I am NOT consuming event } +//////////////////////////////////////////////////////////////////////// +nsresult +nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent) +{ +#ifndef XP_UNIX + nsCOMPtr keyEvent = do_QueryInterface(aKeyEvent); + PRUint32 theChar; + keyEvent->GetKeyCode(&theChar); + + if (mAltKeyDown && (theChar != NS_VK_ALT)) { + mAltKeyDown = PR_FALSE; + + // Do shortcut navigation. + // A letter was pressed. We want to see if a shortcut gets matched. If + // so, we'll know the menu got activated. + keyEvent->GetCharCode(&theChar); + + PRBool active = PR_FALSE; + mMenuBarFrame->ShortcutNavigation(theChar, active); + + if (active) { + aKeyEvent->PreventBubble(); + aKeyEvent->PreventCapture(); + aKeyEvent->PreventDefault(); + } + + return NS_ERROR_BASE; // I am consuming event + } +#endif + return NS_OK; +} + //////////////////////////////////////////////////////////////////////// nsresult nsMenuBarListener::KeyDown(nsIDOMEvent* aKeyEvent) @@ -125,38 +157,12 @@ nsMenuBarListener::KeyDown(nsIDOMEvent* aKeyEvent) // The ALT key just went down by itself. Track this. mAltKeyDown = PR_TRUE; } - return NS_OK; } - - if (mAltKeyDown) { - mAltKeyDown = PR_FALSE; - - // Do shortcut navigation. - // A letter was pressed. We want to see if a shortcut gets matched. If - // so, we'll know the menu got activated. - PRBool active = PR_FALSE; - mMenuBarFrame->ShortcutNavigation(theChar, active); - - if (active) { - aKeyEvent->PreventBubble(); - aKeyEvent->PreventCapture(); - aKeyEvent->PreventDefault(); - } - - return NS_ERROR_BASE; // I am consuming event - } #endif return NS_OK; // means I am NOT consuming event } -//////////////////////////////////////////////////////////////////////// -nsresult -nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent) -{ - return NS_OK; // means I am NOT consuming event -} - //////////////////////////////////////////////////////////////////////// nsresult