From: Cheng Zhao Date: Fri, 8 Aug 2014 06:30:43 +0000 (+0800) Subject: views: Only toggle menu bar when auto-hide-menu-bar is turned on. X-Git-Tag: v0.15.5~12 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=c4b0170a0ac0405309b0578e81252a75977b72b3;p=electron.git views: Only toggle menu bar when auto-hide-menu-bar is turned on. --- diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 26697f0d..d3c12dd8 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -568,6 +568,11 @@ void NativeWindowViews::HandleMouseDown() { void NativeWindowViews::HandleKeyboardEvent( content::WebContents*, const content::NativeWebKeyboardEvent& event) { + keyboard_event_handler_->HandleKeyboardEvent(event, GetFocusManager()); + + if (!menu_bar_autohide_) + return; + // Toggle the menu bar only when a single Alt is released. if (event.type == blink::WebInputEvent::RawKeyDown && IsAltKey(event) && IsAltModifier(event)) { @@ -583,8 +588,6 @@ void NativeWindowViews::HandleKeyboardEvent( // When any other keys except single Alt have been pressed/released: menu_bar_alt_pressed_ = false; } - - keyboard_event_handler_->HandleKeyboardEvent(event, GetFocusManager()); } bool NativeWindowViews::AcceleratorPressed(const ui::Accelerator& accelerator) {