mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Window reloading is handled completely by objective-c now.
This should be a never-do-this-again thing. It's just so we can reload when the app crashes instead of having to use Xcode.
This commit is contained in:
@@ -50,21 +50,28 @@
|
||||
|
||||
// Overridden
|
||||
- (void)sendEvent:(NSEvent *)event {
|
||||
if ([event type] == NSKeyDown) {
|
||||
BOOL handeled = NO;
|
||||
AtomController *controller = [[self keyWindow] windowController];
|
||||
|
||||
// The keyWindow could be a Cocoa Dialog or something, ignore those.
|
||||
if ([controller isKindOfClass:[AtomController class]]) {
|
||||
if ([event type] != NSKeyDown) {
|
||||
[super sendEvent:event];
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL handeled = NO;
|
||||
AtomController *controller = [[self keyWindow] windowController];
|
||||
|
||||
// The keyWindow could be a Cocoa Dialog or something, ignore those.
|
||||
if ([controller isKindOfClass:[AtomController class]]) {
|
||||
// cmd-r should always reload the current controller, so it needs to be here
|
||||
if ([event modifierFlags] & NSCommandKeyMask && [[event charactersIgnoringModifiers] hasPrefix:@"r"]) {
|
||||
[self reloadController:controller];
|
||||
handeled = YES;
|
||||
}
|
||||
else {
|
||||
JSValueRef value = [controller.jscocoa callJSFunctionNamed:@"handleKeyEvent" withArguments:event, nil];
|
||||
handeled = [controller.jscocoa toBool:value];
|
||||
}
|
||||
|
||||
if (!handeled) [super sendEvent:event];
|
||||
}
|
||||
else {
|
||||
[super sendEvent:event];
|
||||
}
|
||||
|
||||
if (!handeled) [super sendEvent:event];
|
||||
}
|
||||
|
||||
- (void)terminate:(id)sender {
|
||||
|
||||
@@ -49,10 +49,6 @@
|
||||
[[webView mainFrame] loadRequest:request];
|
||||
}
|
||||
|
||||
- (void)reload {
|
||||
[(AtomApp *)NSApp reloadController:self];
|
||||
}
|
||||
|
||||
// WebUIDelegate
|
||||
- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems {
|
||||
return defaultMenuItems;
|
||||
|
||||
@@ -4,7 +4,6 @@ app:
|
||||
|
||||
window:
|
||||
'cmd-shift-I': (window) -> window.showConsole()
|
||||
'cmd-r': (window) -> window.reload()
|
||||
'cmd-w': (window) -> window.close()
|
||||
'cmd-o': (window) -> window.open()
|
||||
'cmd-O': (window) -> window.open window.prompt "Open URL:"
|
||||
|
||||
@@ -24,9 +24,6 @@ windowAdditions =
|
||||
setTitle: (title) ->
|
||||
$atomController.window.title = title
|
||||
|
||||
reload: ->
|
||||
$atomController.reload
|
||||
|
||||
open: (url) ->
|
||||
url = atom.native.openPanel() unless url
|
||||
(@resource.open url) or atom.app.open url
|
||||
|
||||
Reference in New Issue
Block a user