Merge pull request #3706 from billyct/master

support an api with SetIgnoreMouseEvents for osx
This commit is contained in:
Cheng Zhao 2015-12-09 12:00:16 +08:00
commit 774ba2a235
6 changed files with 15 additions and 0 deletions

View file

@ -488,6 +488,10 @@ bool Window::IsDocumentEdited() {
return window_->IsDocumentEdited(); return window_->IsDocumentEdited();
} }
void Window::SetIgnoreMouseEvents(bool ignore) {
return window_->SetIgnoreMouseEvents(ignore);
}
void Window::CapturePage(mate::Arguments* args) { void Window::CapturePage(mate::Arguments* args) {
gfx::Rect rect; gfx::Rect rect;
base::Callback<void(const gfx::Image&)> callback; base::Callback<void(const gfx::Image&)> callback;
@ -662,6 +666,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("getRepresentedFilename", &Window::GetRepresentedFilename) .SetMethod("getRepresentedFilename", &Window::GetRepresentedFilename)
.SetMethod("setDocumentEdited", &Window::SetDocumentEdited) .SetMethod("setDocumentEdited", &Window::SetDocumentEdited)
.SetMethod("isDocumentEdited", &Window::IsDocumentEdited) .SetMethod("isDocumentEdited", &Window::IsDocumentEdited)
.SetMethod("setIgnoreMouseEvents", &Window::SetIgnoreMouseEvents)
.SetMethod("focusOnWebView", &Window::FocusOnWebView) .SetMethod("focusOnWebView", &Window::FocusOnWebView)
.SetMethod("blurWebView", &Window::BlurWebView) .SetMethod("blurWebView", &Window::BlurWebView)
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused) .SetMethod("isWebViewFocused", &Window::IsWebViewFocused)

View file

@ -126,6 +126,7 @@ class Window : public mate::TrackableObject<Window>,
std::string GetRepresentedFilename(); std::string GetRepresentedFilename();
void SetDocumentEdited(bool edited); void SetDocumentEdited(bool edited);
bool IsDocumentEdited(); bool IsDocumentEdited();
void SetIgnoreMouseEvents(bool ignore);
void CapturePage(mate::Arguments* args); void CapturePage(mate::Arguments* args);
void SetProgressBar(double progress); void SetProgressBar(double progress);
void SetOverlayIcon(const gfx::Image& overlay, void SetOverlayIcon(const gfx::Image& overlay,

View file

@ -245,6 +245,9 @@ bool NativeWindow::IsDocumentEdited() {
return false; return false;
} }
void NativeWindow::SetIgnoreMouseEvents(bool ignore) {
}
void NativeWindow::SetMenu(ui::MenuModel* menu) { void NativeWindow::SetMenu(ui::MenuModel* menu) {
} }

View file

@ -139,6 +139,7 @@ class NativeWindow : public base::SupportsUserData,
virtual std::string GetRepresentedFilename(); virtual std::string GetRepresentedFilename();
virtual void SetDocumentEdited(bool edited); virtual void SetDocumentEdited(bool edited);
virtual bool IsDocumentEdited(); virtual bool IsDocumentEdited();
virtual void SetIgnoreMouseEvents(bool ignore);
virtual void SetMenu(ui::MenuModel* menu); virtual void SetMenu(ui::MenuModel* menu);
virtual bool HasModalDialog(); virtual bool HasModalDialog();
virtual gfx::NativeWindow GetNativeWindow() = 0; virtual gfx::NativeWindow GetNativeWindow() = 0;

View file

@ -62,6 +62,7 @@ class NativeWindowMac : public NativeWindow {
std::string GetRepresentedFilename() override; std::string GetRepresentedFilename() override;
void SetDocumentEdited(bool edited) override; void SetDocumentEdited(bool edited) override;
bool IsDocumentEdited() override; bool IsDocumentEdited() override;
void SetIgnoreMouseEvents(bool ignore) override;
bool HasModalDialog() override; bool HasModalDialog() override;
gfx::NativeWindow GetNativeWindow() override; gfx::NativeWindow GetNativeWindow() override;
void SetProgressBar(double progress) override; void SetProgressBar(double progress) override;

View file

@ -688,6 +688,10 @@ bool NativeWindowMac::IsDocumentEdited() {
return [window_ isDocumentEdited]; return [window_ isDocumentEdited];
} }
void NativeWindowMac::SetIgnoreMouseEvents(bool ignore) {
[window_ setIgnoresMouseEvents:ignore];
}
bool NativeWindowMac::HasModalDialog() { bool NativeWindowMac::HasModalDialog() {
return [window_ attachedSheet] != nil; return [window_ attachedSheet] != nil;
} }