Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1563)

Unified Diff: ui/views/controls/menu/menu_message_pump_dispatcher_win.cc

Issue 1138523006: Enable keyboard accelerators while a menu is open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handling oshima's comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/menu/menu_message_pump_dispatcher_win.cc
diff --git a/ui/views/controls/menu/menu_message_pump_dispatcher_win.cc b/ui/views/controls/menu/menu_message_pump_dispatcher_win.cc
index 8f905d029aeca1841f28ce83c694c8afe7828e4d..f6bfe43fcac2980121cda0251ab4f83c40ce9473 100644
--- a/ui/views/controls/menu/menu_message_pump_dispatcher_win.cc
+++ b/ui/views/controls/menu/menu_message_pump_dispatcher_win.cc
@@ -47,19 +47,23 @@ uint32_t MenuMessagePumpDispatcher::Dispatch(const MSG& msg) {
break;
}
- // 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: {
- bool result =
- menu_controller_->OnKeyDown(ui::KeyboardCodeFromNative(msg));
- TranslateMessage(&msg);
+ // We do nothing here as the key event will be processed by
+ // MenuEventFilter::OnKeyEvent() as a result of the following dispatch
+ // call. The MenuEventFilter will stop the event propagation, so the
+ // focused window will not get the event.
+ //
+ // NOTE: We don't call TranslateMessage() here as we don't want to
+ // produce a WM_CHAR which will result in inserting a character in a
+ // Textfield while the menu is still open or has just exited.
+ // MenuEventFilter::OnKeyEvent() takes care of everything.
+ DispatchMessage(&msg);
should_perform_default = false;
- should_quit = !result;
break;
}
case WM_CHAR: {
- should_quit = menu_controller_->SelectByChar(
- static_cast<base::char16>(msg.wParam));
+ // We do nothing here. Selecting a menu item by Char is done at the
+ // MenuEventFilter::OnKeyEvent().
should_perform_default = false;
break;
}

Powered by Google App Engine
This is Rietveld 408576698