support an api with SetIgnoreMouseEvents, and worked fine with osx
authorbillyct <billy_allen@126.com>
Sun, 6 Dec 2015 02:14:54 +0000 (10:14 +0800)
committerbillyct <billy_allen@126.com>
Sun, 6 Dec 2015 02:14:54 +0000 (10:14 +0800)
atom/browser/api/atom_api_window.cc
atom/browser/api/atom_api_window.h
atom/browser/native_window.cc
atom/browser/native_window.h
atom/browser/native_window_mac.h
atom/browser/native_window_mac.mm

index 84e5c53..08b5bc4 100644 (file)
@@ -488,6 +488,10 @@ bool Window::IsDocumentEdited() {
   return window_->IsDocumentEdited();
 }
 
+void Window::SetIgnoreMouseEvents(bool ignore) {
+  return window_->SetIgnoreMouseEvents(ignore);
+}
+
 void Window::CapturePage(mate::Arguments* args) {
   gfx::Rect rect;
   base::Callback<void(const gfx::Image&)> callback;
@@ -662,6 +666,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
       .SetMethod("getRepresentedFilename", &Window::GetRepresentedFilename)
       .SetMethod("setDocumentEdited", &Window::SetDocumentEdited)
       .SetMethod("isDocumentEdited", &Window::IsDocumentEdited)
+      .SetMethod("setIgnoreMouseEvents", &Window::SetIgnoreMouseEvents)
       .SetMethod("focusOnWebView", &Window::FocusOnWebView)
       .SetMethod("blurWebView", &Window::BlurWebView)
       .SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
index 6d5ce22..3611c6e 100644 (file)
@@ -126,6 +126,7 @@ class Window : public mate::TrackableObject<Window>,
   std::string GetRepresentedFilename();
   void SetDocumentEdited(bool edited);
   bool IsDocumentEdited();
+  void SetIgnoreMouseEvents(bool ignore);
   void CapturePage(mate::Arguments* args);
   void SetProgressBar(double progress);
   void SetOverlayIcon(const gfx::Image& overlay,
index a3df240..7875670 100644 (file)
@@ -245,6 +245,9 @@ bool NativeWindow::IsDocumentEdited() {
   return false;
 }
 
+void NativeWindow::SetIgnoreMouseEvents(bool ignore) {
+}
+
 void NativeWindow::SetMenu(ui::MenuModel* menu) {
 }
 
index 0c918d9..3eb235b 100644 (file)
@@ -139,6 +139,7 @@ class NativeWindow : public base::SupportsUserData,
   virtual std::string GetRepresentedFilename();
   virtual void SetDocumentEdited(bool edited);
   virtual bool IsDocumentEdited();
+  virtual void SetIgnoreMouseEvents(bool ignore);
   virtual void SetMenu(ui::MenuModel* menu);
   virtual bool HasModalDialog();
   virtual gfx::NativeWindow GetNativeWindow() = 0;
index 08f9198..3884514 100644 (file)
@@ -62,6 +62,7 @@ class NativeWindowMac : public NativeWindow {
   std::string GetRepresentedFilename() override;
   void SetDocumentEdited(bool edited) override;
   bool IsDocumentEdited() override;
+  void SetIgnoreMouseEvents(bool ignore) override;
   bool HasModalDialog() override;
   gfx::NativeWindow GetNativeWindow() override;
   void SetProgressBar(double progress) override;
index 42894c1..049c3ee 100644 (file)
@@ -687,6 +687,10 @@ bool NativeWindowMac::IsDocumentEdited() {
   return [window_ isDocumentEdited];
 }
 
+void NativeWindowMac::SetIgnoreMouseEvents(bool ignore) {
+  [window_ setIgnoresMouseEvents:ignore];
+}
+
 bool NativeWindowMac::HasModalDialog() {
   return [window_ attachedSheet] != nil;
 }