mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Move refresh handling to keyDown: method on AtomController. Eliminate custom handleInputEvent method. NSApplication-sendEvent calls performKeyEquivalents on keydown events. Here I override sendEvent for keydown and forward the event to its window. This allows the web view to receive Command-H etc without key equivalents interfering. If the web view short-circuits the event, then the key equivalent will not be invoked. But it can let the event pass through and it ends up invoking the key equivalent anyway via a mechanism I don't fully understand. Apparently Cocoa tries to execute key equivalents after the web view finishes with the event? But it works great.
23 lines
513 B
Objective-C
23 lines
513 B
Objective-C
#import <Cocoa/Cocoa.h>
|
|
#import "JSCocoa.h"
|
|
|
|
@class JSCocoa;
|
|
@class WebView;
|
|
|
|
struct JSGlobalContextRef;
|
|
|
|
@interface AtomController : NSWindowController <NSWindowDelegate>
|
|
|
|
@property (assign) WebView *webView;
|
|
@property (nonatomic, retain, readonly) NSString *url;
|
|
@property (nonatomic, retain, readonly) NSString *bootstrapScript;
|
|
|
|
- (id)initForSpecs;
|
|
- (id)initWithURL:(NSString *)url;
|
|
|
|
- (void)triggerAtomEventWithName:(NSString *)name data:(id)data;
|
|
- (void)reload;
|
|
- (JSValueRefAndContextRef)jsWindow;
|
|
|
|
@end
|