Merge pull request #6068 from electron/redispatch-events
Redispatch events to handle native OSX shortcuts
This commit is contained in:
commit
6f4899bd94
3 changed files with 10 additions and 14 deletions
|
@ -6,9 +6,14 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "brightray/browser/mac/event_dispatching_window.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "ui/events/keycodes/keyboard_codes.h"
|
||||
|
||||
@interface NSWindow (EventDispatchingWindow)
|
||||
- (void)redispatchKeyEvent:(NSEvent*)event;
|
||||
@end
|
||||
|
||||
namespace atom {
|
||||
|
||||
void CommonWebContentsDelegate::HandleKeyboardEvent(
|
||||
|
@ -22,18 +27,8 @@ void CommonWebContentsDelegate::HandleKeyboardEvent(
|
|||
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen())
|
||||
ExitFullscreenModeForTab(source);
|
||||
|
||||
BOOL handled = [[NSApp mainMenu] performKeyEquivalent:event.os_event];
|
||||
if (!handled && event.os_event.window) {
|
||||
// Handle the cmd+~ shortcut.
|
||||
if ((event.os_event.modifierFlags & NSCommandKeyMask) /* cmd */ &&
|
||||
(event.os_event.keyCode == 50 /* ~ */)) {
|
||||
if (event.os_event.modifierFlags & NSShiftKeyMask) {
|
||||
[NSApp sendAction:@selector(_cycleWindowsReversed:) to:nil from:nil];
|
||||
} else {
|
||||
[NSApp sendAction:@selector(_cycleWindows:) to:nil from:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.os_event.window)
|
||||
[event.os_event.window redispatchKeyEvent:event.os_event];
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "brightray/browser/inspectable_web_contents.h"
|
||||
#include "brightray/browser/inspectable_web_contents_view.h"
|
||||
#include "brightray/browser/mac/event_dispatching_window.h"
|
||||
#include "content/public/browser/browser_accessibility_state.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
|
@ -270,7 +271,7 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
|
||||
@end
|
||||
|
||||
@interface AtomNSWindow : NSWindow {
|
||||
@interface AtomNSWindow : EventDispatchingWindow {
|
||||
@private
|
||||
atom::NativeWindowMac* shell_;
|
||||
bool enable_larger_than_screen_;
|
||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 717d92968d7959814060b9409c4720ab647bd90e
|
||||
Subproject commit 2f931b6a8947fb9c336d880d9ddac8987527ac81
|
Loading…
Reference in a new issue