mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Global Keyboard shortcuts work from spec window.
This commit is contained in:
@@ -40,7 +40,8 @@
|
||||
|
||||
if ([[self mainMenu] performKeyEquivalent:event]) return;
|
||||
|
||||
if (_clientHandler && ![self keyWindow] && [event type] == NSKeyDown) {
|
||||
bool windowHandlesKeyEvents = [[[self keyWindow] windowController] handlesKeyEvents];
|
||||
if (_clientHandler && !windowHandlesKeyEvents && [event type] == NSKeyDown) {
|
||||
[_hiddenWindow makeKeyAndOrderFront:self];
|
||||
[_hiddenWindow sendEvent:event];
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ class ClientHandler;
|
||||
NSView *_webView;
|
||||
NSString *_bootstrapScript;
|
||||
NSString *_pathToOpen;
|
||||
|
||||
bool _handlesKeyEvents;
|
||||
|
||||
CefRefPtr<CefV8Context> _atomContext;
|
||||
CefRefPtr<ClientHandler> _clientHandler;
|
||||
@@ -17,6 +19,7 @@ class ClientHandler;
|
||||
- (id)initWithBootstrapScript:(NSString *)bootstrapScript atomContext:(CefRefPtr<CefV8Context>) context;
|
||||
- (id)initWithPath:(NSString *)path atomContext:(CefRefPtr<CefV8Context>)atomContext;
|
||||
- (id)initSpecsWithAtomContext:(CefRefPtr<CefV8Context>)atomContext;
|
||||
- (bool)handlesKeyEvents;
|
||||
|
||||
- (void)createBrowser;
|
||||
|
||||
|
||||
@@ -29,10 +29,12 @@
|
||||
|
||||
- (id)initWithPath:(NSString *)path atomContext:(CefRefPtr<CefV8Context>)atomContext {
|
||||
_pathToOpen = [path retain];
|
||||
_handlesKeyEvents = YES;
|
||||
return [self initWithBootstrapScript:@"window-bootstrap" atomContext:atomContext];
|
||||
}
|
||||
|
||||
- (id)initSpecsWithAtomContext:(CefRefPtr<CefV8Context>)atomContext {
|
||||
_handlesKeyEvents = NO;
|
||||
return [self initWithBootstrapScript:@"spec-bootstrap" atomContext:atomContext];
|
||||
}
|
||||
|
||||
@@ -56,6 +58,10 @@
|
||||
CefBrowser::CreateBrowser(window_info, _clientHandler.get(), [indexURLString UTF8String], settings);
|
||||
}
|
||||
|
||||
- (bool)handlesKeyEvents {
|
||||
return _handlesKeyEvents;
|
||||
}
|
||||
|
||||
#pragma mark BrowserDelegate
|
||||
|
||||
- (void)loadStart {
|
||||
|
||||
Reference in New Issue
Block a user