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