Merge pull request #6370 from electron/send-key-event-to-main-menu
Give menu a chance to handle keydown event before window
This commit is contained in:
commit
c7e0df09bc
1 changed files with 5 additions and 0 deletions
|
@ -27,6 +27,11 @@ void CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||||
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
|
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
|
||||||
ExitFullscreenModeForTab(source);
|
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)
|
if (event.os_event.window)
|
||||||
[event.os_event.window redispatchKeyEvent:event.os_event];
|
[event.os_event.window redispatchKeyEvent:event.os_event];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue