diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index c22159fc25db..46c3250a94a6 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -281,9 +281,6 @@ bool NativeWindow::IsDocumentEdited() { return false; } -void NativeWindow::SetIgnoreMouseEvents(bool ignore) { -} - void NativeWindow::SetMenu(ui::MenuModel* menu) { } diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 0846fbde4a9c..a12663a1aa5a 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -154,7 +154,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 SetIgnoreMouseEvents(bool ignore) = 0; virtual void SetMenu(ui::MenuModel* menu); virtual bool HasModalDialog(); virtual gfx::NativeWindow GetNativeWindow() = 0; diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 6a0919635f3e..6b16072f6adb 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -672,6 +672,17 @@ bool NativeWindowViews::HasShadow() { return wm::GetShadowType(GetNativeWindow()) != wm::SHADOW_TYPE_NONE; } +void NativeWindowViews::SetIgnoreMouseEvents(bool ignore) { +#if defined(OS_WIN) + LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE); + if (ignore) + ex_style |= (WS_EX_TRANSPARENT | WS_EX_LAYERED); + else + ex_style &= ~(WS_EX_TRANSPARENT | WS_EX_LAYERED); + ::SetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE, ex_style); +#endif +} + void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) { if (menu_model == nullptr) { // Remove accelerators diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index 909c5b6fd4ba..6a26c14e0084 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -91,6 +91,7 @@ class NativeWindowViews : public NativeWindow, void SetBackgroundColor(const std::string& color_name) override; void SetHasShadow(bool has_shadow) override; bool HasShadow() override; + void SetIgnoreMouseEvents(bool ignore) override; void SetMenu(ui::MenuModel* menu_model) override; gfx::NativeWindow GetNativeWindow() override; void SetOverlayIcon(const gfx::Image& overlay,