]> khamidou — GitHub mirrors - electron.git/commitdiff
Update to the new patch for acceptsFirstMouse
authorCheng Zhao <zcbenz@gmail.com>
Mon, 27 Apr 2015 03:47:26 +0000 (11:47 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 29 Apr 2015 02:26:31 +0000 (10:26 +0800)
atom/browser/native_window_mac.mm

index 946b2a41cdd43eb68f7b19775df4a242a6c8bd34..12a147ebc2b339226bb6be9fc2a8814ebc1e46a1 100644 (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;