diff options
-rw-r--r-- | ui/aura/window.cc | 4 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host_win.cc | 17 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host_win.h | 2 |
3 files changed, 14 insertions, 9 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index e5289e4..5c7007e 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -224,9 +224,9 @@ void Window::SetName(const std::string& name) { } void Window::SetTransparent(bool transparent) { - // Cannot change transparent flag after the window is initialized. - DCHECK(!layer()); transparent_ = transparent; + if (layer()) + layer_->SetFillsBoundsOpaquely(!transparent_); } RootWindow* Window::GetRootWindow() { diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc index f04b90b..c2e2e88 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc @@ -122,13 +122,7 @@ aura::RootWindow* DesktopRootWindowHostWin::Init( rw_params.host = this; root_window_ = new aura::RootWindow(rw_params); - // TODO(beng): We probably need to move these two calls to some function that - // can change depending on the native-ness of the frame. For right - // now in the hack-n-slash days of win-aura, we can just - // unilaterally turn this on. - root_window_->compositor()->SetHostHasTransparentBackground(true); - root_window_->SetTransparent(true); - + SetWindowTransparency(); root_window_->Init(); root_window_->AddChild(content_window_); @@ -344,6 +338,7 @@ bool DesktopRootWindowHostWin::ShouldUseNativeFrame() { void DesktopRootWindowHostWin::FrameTypeChanged() { message_handler_->FrameTypeChanged(); + SetWindowTransparency(); } NonClientFrameView* DesktopRootWindowHostWin::CreateNonClientFrameView() { @@ -353,6 +348,7 @@ NonClientFrameView* DesktopRootWindowHostWin::CreateNonClientFrameView() { void DesktopRootWindowHostWin::SetFullscreen(bool fullscreen) { message_handler_->fullscreen_handler()->SetFullscreen(fullscreen); + SetWindowTransparency(); } bool DesktopRootWindowHostWin::IsFullscreen() const { @@ -412,6 +408,7 @@ void DesktopRootWindowHostWin::Hide() { } void DesktopRootWindowHostWin::ToggleFullScreen() { + SetWindowTransparency(); } // GetBounds and SetBounds work in pixel coordinates, whereas other get/set @@ -863,6 +860,12 @@ HWND DesktopRootWindowHostWin::GetHWND() const { return message_handler_->hwnd(); } +void DesktopRootWindowHostWin::SetWindowTransparency() { + bool transparent = ShouldUseNativeFrame() && !IsFullscreen(); + root_window_->compositor()->SetHostHasTransparentBackground(transparent); + root_window_->SetTransparent(transparent); +} + //////////////////////////////////////////////////////////////////////////////// // DesktopRootWindowHost, public: diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.h b/ui/views/widget/desktop_aura/desktop_root_window_host_win.h index 59e54d8..028e608 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.h @@ -207,6 +207,8 @@ class VIEWS_EXPORT DesktopRootWindowHostWin HWND GetHWND() const; private: + void SetWindowTransparency(); + // We are owned by the RootWindow, but we have to have a back pointer to it. aura::RootWindow* root_window_; |