Make hasShadow work on Windows/Linux

This commit is contained in:
Cheng Zhao 2016-01-23 02:55:12 -08:00
parent d704b3f7ba
commit 239bfe970c
5 changed files with 21 additions and 20 deletions

View file

@ -155,6 +155,11 @@ NativeWindowViews::NativeWindowViews(
if (transparent())
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
// The given window is most likely not rectangular since it uses
// transparency and has no standard frame, don't show a shadow for it.
if (transparent() && !has_frame())
params.shadow_type = Widget::InitParams::SHADOW_TYPE_NONE;
#if defined(OS_WIN)
params.native_widget =
new views::DesktopNativeWidgetAura(window_.get());
@ -259,11 +264,6 @@ NativeWindowViews::NativeWindowViews(
window_->FrameTypeChanged();
}
// The given window is most likely not rectangular since it uses
// transparency and has no standard frame, don't show a shadow for it.
if (transparent() && !has_frame())
wm::SetShadowType(GetNativeWindow(), wm::SHADOW_TYPE_NONE);
gfx::Size size = bounds.size();
if (has_frame() &&
options.Get(options::kUseContentSize, &use_content_size_) &&
@ -597,6 +597,14 @@ void NativeWindowViews::SetBackgroundColor(const std::string& color_name) {
#endif
}
void NativeWindowViews::SetHasShadow(bool has_shadow) {
wm::SetShadowType(GetNativeWindow(), wm::SHADOW_TYPE_NONE);
}
bool NativeWindowViews::HasShadow() {
return wm::GetShadowType(GetNativeWindow()) != wm::SHADOW_TYPE_NONE;
}
void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) {
if (menu_model == nullptr) {
// Remove accelerators