]> khamidou — GitHub mirrors - electron.git/commitdiff
A little cleanup.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 18 Aug 2014 08:14:28 +0000 (16:14 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 18 Aug 2014 08:19:23 +0000 (16:19 +0800)
atom.gyp
atom/browser/native_window_views.cc

index e880d1269c174e2f0c1c0dc746835de01569c13b..44e5e3e8b48f2e2875f487efaf51ad733b2b6ac5 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
       'atom/browser/ui/views/global_menu_bar_x11.h',
       'atom/browser/ui/views/menu_bar.cc',
       'atom/browser/ui/views/menu_bar.h',
-      'atom/browser/ui/views/submenu_button.cc',
-      'atom/browser/ui/views/submenu_button.h',
       'atom/browser/ui/views/menu_delegate.cc',
       'atom/browser/ui/views/menu_delegate.h',
       'atom/browser/ui/views/menu_layout.cc',
       'atom/browser/ui/views/menu_layout.h',
+      'atom/browser/ui/views/submenu_button.cc',
+      'atom/browser/ui/views/submenu_button.h',
       'atom/browser/ui/views/win_frame_view.cc',
       'atom/browser/ui/views/win_frame_view.h',
       'atom/browser/ui/win/notify_icon_host.cc',
index a2702d36ebe97d6408819a494c6a07d0255ca686..efadac5c46bd2fe8a3a0961ac5b670e2d4b2a38a 100644 (file)
@@ -572,22 +572,24 @@ void NativeWindowViews::HandleKeyboardEvent(
     const content::NativeWebKeyboardEvent& event) {
   keyboard_event_handler_->HandleKeyboardEvent(event, GetFocusManager());
 
-  if (menu_bar_) {
-    // Toggle accelerator when "Alt" is pressed.
-    if (menu_bar_visible_ && IsAltKey(event))
-      menu_bar_->SetAcceleratorVisibility(
-          event.type == blink::WebInputEvent::RawKeyDown);
-
-    // Show the submenu when "Alt+Key" is pressed.
-    if (event.type == blink::WebInputEvent::RawKeyDown && !IsAltKey(event) &&
-        IsAltModifier(event)) {
-      if (!menu_bar_visible_ &&
-          (menu_bar_->GetAcceleratorIndex(event.windowsKeyCode) != -1)) {
-        SetMenuBarVisibility(true);
-        Layout();
-      }
-      menu_bar_->ActivateAccelerator(event.windowsKeyCode);
+  if (!menu_bar_)
+    return;
+
+  // Show accelerator when "Alt" is pressed.
+  if (menu_bar_visible_ && IsAltKey(event))
+    menu_bar_->SetAcceleratorVisibility(
+        event.type == blink::WebInputEvent::RawKeyDown);
+
+  // Show the submenu when "Alt+Key" is pressed.
+  if (event.type == blink::WebInputEvent::RawKeyDown && !IsAltKey(event) &&
+      IsAltModifier(event)) {
+    if (!menu_bar_visible_ &&
+        (menu_bar_->GetAcceleratorIndex(event.windowsKeyCode) != -1)) {
+      SetMenuBarVisibility(true);
+      Layout();
     }
+    menu_bar_->ActivateAccelerator(event.windowsKeyCode);
+    return;
   }
 
   if (!menu_bar_autohide_)