Skip to content

Commit

Permalink
fix: only try to activate accelerator if it's registered
Browse files Browse the repository at this point in the history
  • Loading branch information
brenca committed Oct 21, 2018
1 parent 585bc48 commit 9f9fa1f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions atom/browser/ui/views/root_view.cc
Expand Up @@ -119,14 +119,17 @@ void RootView::HandleKeyEvent(const content::NativeWebKeyboardEvent& event) {
// Show the submenu when "Alt+Key" is pressed.
if (event.GetType() == blink::WebInputEvent::kRawKeyDown &&
!IsAltKey(event) && IsAltModifier(event)) {
if (!menu_bar_visible_ &&
(menu_bar_->HasAccelerator(event.windows_key_code)))
SetMenuBarVisibility(true);
if (menu_bar_->HasAccelerator(event.windows_key_code)) {
if (!menu_bar_visible_) {
SetMenuBarVisibility(true);

View* focused_view = GetFocusManager()->GetFocusedView();
last_focused_view_tracker_->SetView(focused_view);
menu_bar_->RequestFocus();
menu_bar_->ActivateAccelerator(event.windows_key_code);
View* focused_view = GetFocusManager()->GetFocusedView();
last_focused_view_tracker_->SetView(focused_view);
menu_bar_->RequestFocus();
}

menu_bar_->ActivateAccelerator(event.windows_key_code);
}
return;
}

Expand Down

0 comments on commit 9f9fa1f

Please sign in to comment.