]> khamidou — GitHub mirrors - electron.git/commitdiff
views: Only toggle menu bar when auto-hide-menu-bar is turned on.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 8 Aug 2014 06:30:43 +0000 (14:30 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 8 Aug 2014 06:30:43 +0000 (14:30 +0800)
atom/browser/native_window_views.cc

index 26697f0dcba3a2bf553a12753f8071872b9003b4..d3c12dd88218cc4d1556c0d74f4f06c800ac0f44 100644 (file)
@@ -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) {