Make hasShadow work on Windows/Linux
This commit is contained in:
parent
d704b3f7ba
commit
239bfe970c
5 changed files with 21 additions and 20 deletions
|
@ -125,6 +125,10 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
|
|||
if (options.Get(options::kMovable, &movable) && movable) {
|
||||
SetMovable(movable);
|
||||
}
|
||||
bool has_shadow;
|
||||
if (options.Get(options::kHasShadow, &has_shadow)) {
|
||||
SetHasShadow(has_shadow);
|
||||
}
|
||||
bool top;
|
||||
if (options.Get(options::kAlwaysOnTop, &top) && top) {
|
||||
SetAlwaysOnTop(true);
|
||||
|
@ -555,13 +559,6 @@ void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,
|
|||
callback.Run(bitmap);
|
||||
}
|
||||
|
||||
void NativeWindow::SetHasShadow(bool has_shadow) {
|
||||
}
|
||||
|
||||
bool NativeWindow::HasShadow() {
|
||||
return true;
|
||||
}
|
||||
|
||||
SkColor NativeWindow::ParseHexColor(const std::string& name) {
|
||||
SkColor result = 0xFF000000;
|
||||
unsigned value = 0;
|
||||
|
|
|
@ -145,8 +145,8 @@ class NativeWindow : public base::SupportsUserData,
|
|||
virtual void SetKiosk(bool kiosk) = 0;
|
||||
virtual bool IsKiosk() = 0;
|
||||
virtual void SetBackgroundColor(const std::string& color_name) = 0;
|
||||
virtual void SetHasShadow(bool has_shadow);
|
||||
virtual bool HasShadow();
|
||||
virtual void SetHasShadow(bool has_shadow) = 0;
|
||||
virtual bool HasShadow() = 0;
|
||||
virtual void SetRepresentedFilename(const std::string& filename);
|
||||
virtual std::string GetRepresentedFilename();
|
||||
virtual void SetDocumentEdited(bool edited);
|
||||
|
|
|
@ -449,12 +449,6 @@ NativeWindowMac::NativeWindowMac(
|
|||
if (!has_frame())
|
||||
[window_ setOpaque:NO];
|
||||
|
||||
bool has_shadow = true;
|
||||
options.Get(options::kHasShadow, &has_shadow);
|
||||
if (!has_shadow) {
|
||||
SetHasShadow(false);
|
||||
}
|
||||
|
||||
// We will manage window's lifetime ourselves.
|
||||
[window_ setReleasedWhenClosed:NO];
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -88,6 +88,8 @@ class NativeWindowViews : public NativeWindow,
|
|||
void SetKiosk(bool kiosk) override;
|
||||
bool IsKiosk() override;
|
||||
void SetBackgroundColor(const std::string& color_name) override;
|
||||
void SetHasShadow(bool has_shadow) override;
|
||||
bool HasShadow() override;
|
||||
void SetMenu(ui::MenuModel* menu_model) override;
|
||||
gfx::NativeWindow GetNativeWindow() override;
|
||||
void SetOverlayIcon(const gfx::Image& overlay,
|
||||
|
|
Loading…
Add table
Reference in a new issue