Give menu a chance to handle key event before window

This commit is contained in:
Kevin Sawicki 2016-07-06 10:10:01 -07:00
parent d42d10a47c
commit bd33961964

View file

@ -27,6 +27,11 @@ void CommonWebContentsDelegate::HandleKeyboardEvent(
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
ExitFullscreenModeForTab(source);
// Send the event to the menu before sending it to the window
if (event.os_event.type == NSKeyDown &&
[[NSApp mainMenu] performKeyEquivalent:event.os_event])
return;
if (event.os_event.window)
[event.os_event.window redispatchKeyEvent:event.os_event];
}