summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 20:24:25 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 20:24:25 +0000
commit2ee3dcd657f6df5e213e190330b8a8959358bb14 (patch)
treef4a51645fac40132b21a8779f5a439202b7d610c /views
parentfa54524d2c3291d0c1228f42878e6ce455d37039 (diff)
downloadchromium_src-2ee3dcd657f6df5e213e190330b8a8959358bb14.zip
chromium_src-2ee3dcd657f6df5e213e190330b8a8959358bb14.tar.gz
chromium_src-2ee3dcd657f6df5e213e190330b8a8959358bb14.tar.bz2
Changes the menu code to show mnemonics if the alt key is down.
BUG=46445 TEST=press alt-f on windows and make sure the mnemonics are shown. Review URL: http://codereview.chromium.org/2842041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/menu_item_view.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index 31f33a7..cb87761 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -14,6 +14,10 @@
#include "views/controls/menu/menu_separator.h"
#include "views/controls/menu/submenu_view.h"
+#if defined(OS_WIN)
+#include "base/win_util.h"
+#endif
+
namespace views {
namespace {
@@ -110,8 +114,15 @@ void MenuItemView::RunMenuAt(gfx::NativeWindow parent,
const gfx::Rect& bounds,
AnchorPosition anchor,
bool has_mnemonics) {
- // Show mnemonics if the button has focus. This mirrors what windows does.
- PrepareForRun(has_mnemonics, button ? button->HasFocus() : false);
+ // Show mnemonics if the button has focus or alt is pressed.
+ bool show_mnemonics = button ? button->HasFocus() : false;
+#if defined(OS_WIN)
+ // We don't currently need this on gtk as showing the menu gives focus to the
+ // button first.
+ if (!show_mnemonics)
+ show_mnemonics = win_util::IsAltPressed();
+#endif
+ PrepareForRun(has_mnemonics, show_mnemonics);
int mouse_event_flags;
MenuController* controller = MenuController::GetActiveInstance();