Implement SetIgnoreMouseEvents for Windows

This commit is contained in:
Cheng Zhao 2016-06-07 19:38:41 +09:00
parent fe4b957587
commit cae25cab3e
4 changed files with 13 additions and 4 deletions

View file

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

View file

@ -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;

View file

@ -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

View file

@ -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,