Update to the new patch for acceptsFirstMouse

This commit is contained in:
Cheng Zhao 2015-04-27 11:47:26 +08:00
parent d826e1e5fb
commit 3a50c9e48c

View file

@ -54,10 +54,8 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
@interface AtomNSWindowDelegate : NSObject<NSWindowDelegate> { @interface AtomNSWindowDelegate : NSObject<NSWindowDelegate> {
@private @private
atom::NativeWindowMac* shell_; atom::NativeWindowMac* shell_;
BOOL acceptsFirstMouse_;
} }
- (id)initWithShell:(atom::NativeWindowMac*)shell; - (id)initWithShell:(atom::NativeWindowMac*)shell;
- (void)setAcceptsFirstMouse:(BOOL)accept;
@end @end
@implementation AtomNSWindowDelegate @implementation AtomNSWindowDelegate
@ -65,15 +63,10 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
- (id)initWithShell:(atom::NativeWindowMac*)shell { - (id)initWithShell:(atom::NativeWindowMac*)shell {
if ((self = [super init])) { if ((self = [super init])) {
shell_ = shell; shell_ = shell;
acceptsFirstMouse_ = NO;
} }
return self; return self;
} }
- (void)setAcceptsFirstMouse:(BOOL)accept {
acceptsFirstMouse_ = accept;
}
- (void)windowDidBecomeMain:(NSNotification*)notification { - (void)windowDidBecomeMain:(NSNotification*)notification {
content::WebContents* web_contents = shell_->GetWebContents(); content::WebContents* web_contents = shell_->GetWebContents();
if (!web_contents) if (!web_contents)
@ -151,10 +144,6 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
return NO; return NO;
} }
- (BOOL)acceptsFirstMouse:(NSEvent*)event {
return acceptsFirstMouse_;
}
@end @end
@interface AtomNSWindow : EventProcessingWindow { @interface AtomNSWindow : EventProcessingWindow {
@ -162,6 +151,7 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
atom::NativeWindowMac* shell_; atom::NativeWindowMac* shell_;
bool enable_larger_than_screen_; bool enable_larger_than_screen_;
} }
@property BOOL acceptsFirstMouse;
- (void)setShell:(atom::NativeWindowMac*)shell; - (void)setShell:(atom::NativeWindowMac*)shell;
- (void)setEnableLargerThanScreen:(bool)enable; - (void)setEnableLargerThanScreen:(bool)enable;
@end @end
@ -355,7 +345,7 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
// Enable the NSView to accept first mouse event. // Enable the NSView to accept first mouse event.
bool acceptsFirstMouse = false; bool acceptsFirstMouse = false;
options.Get(switches::kAcceptFirstMouse, &acceptsFirstMouse); options.Get(switches::kAcceptFirstMouse, &acceptsFirstMouse);
[window_delegate_ setAcceptsFirstMouse:acceptsFirstMouse]; [window_ setAcceptsFirstMouse:acceptsFirstMouse];
// Disable fullscreen button when 'fullscreen' is specified to false. // Disable fullscreen button when 'fullscreen' is specified to false.
bool fullscreen; bool fullscreen;