diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 21:54:28 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 21:54:28 +0000 |
commit | 6840158fdaef4b2ece5ee8248907454fb4b7a84f (patch) | |
tree | d0afb0cd60e925fb295d7add3277cee4731faa33 /chrome/views/chrome_menu.cc | |
parent | 32638bfc967b411572c425840422e432a640c25a (diff) | |
download | chromium_src-6840158fdaef4b2ece5ee8248907454fb4b7a84f.zip chromium_src-6840158fdaef4b2ece5ee8248907454fb4b7a84f.tar.gz chromium_src-6840158fdaef4b2ece5ee8248907454fb4b7a84f.tar.bz2 |
Fixes two menu bugs:
. Pressing shift-F10 would make context menu appear then immediately
disappear. This is because MenuController was hiding on a
WM_SYSKEYUP. I've changed MenuController to do nothing on
WM_SYSKEYUP. If a sys key is pressed again, we'll get a
WM_SYSKEYDOWN and hide there.
. MenuController needed to handle WM_CONTEXTMENU and not dispatch it,
otheriwse we could end up with stacked menus.
BUG=3685
TEST=bring up bookmark manager, select a row in the table on the
right. Press shift-F10 and make sure the context menu appears and
stays up.
Review URL: http://codereview.chromium.org/10635
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5299 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/chrome_menu.cc')
-rw-r--r-- | chrome/views/chrome_menu.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc index 209e02e..275a5c7 100644 --- a/chrome/views/chrome_menu.cc +++ b/chrome/views/chrome_menu.cc @@ -2005,6 +2005,17 @@ bool MenuController::Dispatch(const MSG& msg) { // NOTE: we don't get WM_ACTIVATE or anything else interesting in here. switch (msg.message) { + case WM_CONTEXTMENU: { + MenuItemView* item = pending_state_.item; + if (item) { + gfx::Point screen_loc(0, item->height()); + View::ConvertPointToScreen(item, &screen_loc); + item->GetDelegate()->ShowContextMenu( + item, item->GetCommand(), screen_loc.x(), screen_loc.y(), false); + } + return true; + } + // NOTE: focus wasn't changed when the menu was shown. As such, don't // dispatch key events otherwise the focused window will get the events. case WM_KEYDOWN: @@ -2016,9 +2027,14 @@ bool MenuController::Dispatch(const MSG& msg) { case WM_KEYUP: return true; + case WM_SYSKEYUP: + // We may have been shown on a system key, as such don't do anything + // here. If another system key is pushed we'll get a WM_SYSKEYDOWN and + // close the menu. + return true; + case WM_CANCELMODE: case WM_SYSKEYDOWN: - case WM_SYSKEYUP: // Exit immediately on system keys. Cancel(true); return false; @@ -2083,6 +2099,9 @@ bool MenuController::OnKeyDown(const MSG& msg) { } break; + case VK_APPS: + break; + default: TranslateMessage(&msg); break; |