mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Fix to bug 14368 - Win32 - F10 key does not activate the menu bar.
r=dean_tessman@hotmail.com, sr=hyatt@netscape.com
This commit is contained in:
parent
eeb1d1acb8
commit
1f60ff29b4
@ -20,6 +20,8 @@
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dean Tessman <dean_tessman@hotmail.com>
|
||||
* Mark Hammond <markh@ActiveState.com>
|
||||
*/
|
||||
|
||||
#include "nsMenuBarListener.h"
|
||||
@ -205,6 +207,26 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
retVal = NS_ERROR_BASE; // I am consuming event
|
||||
}
|
||||
}
|
||||
#ifdef XP_WIN
|
||||
// Also need to handle F10 specially on Windows.
|
||||
else if (theChar == NS_VK_F10) {
|
||||
PRBool alt,ctrl,shift,meta;
|
||||
keyEvent->GetAltKey(&alt);
|
||||
keyEvent->GetCtrlKey(&ctrl);
|
||||
keyEvent->GetShiftKey(&shift);
|
||||
keyEvent->GetMetaKey(&meta);
|
||||
if (!(shift || alt || meta)) {
|
||||
// The F10 key just went down by itself or with ctrl pressed.
|
||||
// In Windows, both of these activate the menu bar.
|
||||
mMenuBarFrame->ToggleMenuActiveState();
|
||||
|
||||
aKeyEvent->PreventBubble();
|
||||
aKeyEvent->PreventCapture();
|
||||
aKeyEvent->PreventDefault();
|
||||
return NS_ERROR_BASE; // consume the event
|
||||
}
|
||||
}
|
||||
#endif // XP_WIN
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
|
@ -2923,8 +2923,12 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
|
||||
result = PR_FALSE;
|
||||
}
|
||||
|
||||
if (wParam == VK_MENU) {
|
||||
// This is required to make XP menus work.
|
||||
if (wParam == VK_MENU || wParam == VK_F10) {
|
||||
// This is required to prevent Windows
|
||||
// default menu processing getting in the
|
||||
// way of XP menus and key handling.
|
||||
// Without this we call DefWindowProc which will
|
||||
// send us WM_COMMAND and/or WM_SYSCOMMAND messages.
|
||||
// Do not remove! Talk to me if you have
|
||||
// questions. - hyatt@netscape.com
|
||||
result = PR_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user