From fb5547bb8b94a50560e6ea44f51872b6f47e8b0e Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Sat, 18 Jul 2009 05:11:33 +0000 Subject: Fix frame turning black when reseting theme. Also simplifies the frame type changed code somewhat. It turns out the frame still needs to be hidden for WM_DWMCOMPOSITIONCHANGED message handlers however. Not sure why, but this is the simplest/least buggy this code has been so far so I can live with it. http://crbug.com/14578 TEST=see bug Review URL: http://codereview.chromium.org/159050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21045 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/frame/browser_frame_win.cc | 22 ++++++++++------------ chrome/browser/views/frame/browser_view.cc | 2 -- 2 files changed, 10 insertions(+), 14 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/views/frame/browser_frame_win.cc b/chrome/browser/views/frame/browser_frame_win.cc index 206f05f..7fd9702 100644 --- a/chrome/browser/views/frame/browser_frame_win.cc +++ b/chrome/browser/views/frame/browser_frame_win.cc @@ -174,16 +174,6 @@ LRESULT BrowserFrameWin::OnNCActivate(BOOL active) { if (browser_view_->ActivateAppModalDialog()) return TRUE; - // Perform first time initialization of the DWM frame insets, only if we're - // using the native frame. - if (GetNonClientView()->UseNativeFrame() && !frame_initialized_) { - if (browser_view_->IsBrowserTypeNormal()) { - ::SetWindowPos(GetNativeView(), NULL, 0, 0, 0, 0, - SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED); - UpdateDWMFrame(); - } - frame_initialized_ = true; - } browser_view_->ActivationChanged(!!active); return WindowWin::OnNCActivate(active); } @@ -235,8 +225,6 @@ LRESULT BrowserFrameWin::OnNCCalcSize(BOOL mode, LPARAM l_param) { client_rect->right -= border_thickness; client_rect->bottom -= border_thickness; - UpdateDWMFrame(); - // We'd like to return WVR_REDRAW in some cases here, but because we almost // always have nonclient area (except in fullscreen mode, where it doesn't // matter), we can't. See comments in window.cc:OnNCCalcSize() for more info. @@ -296,6 +284,8 @@ void BrowserFrameWin::OnWindowPosChanged(WINDOWPOS* window_pos) { GetNonClientView()->SchedulePaint(); } + UpdateDWMFrame(); + // Let the default window procedure handle - IMPORTANT! WindowWin::OnWindowPosChanged(window_pos); } @@ -349,6 +339,14 @@ void BrowserFrameWin::UpdateDWMFrame() { margins.cyTopHeight = GetBoundsForTabStrip(browser_view_->tabstrip()).bottom(); } + + // If DWM is supported, we may still not want to use the DWM frame if we're in + // opaque mode (e.g. showing a theme). In this case we want to reset the DWM + // frame extending. + if (!GetNonClientView()->UseNativeFrame()) { + margins.cxLeftWidth = margins.cxRightWidth = margins.cyTopHeight = + margins.cyBottomHeight = 0; + } DwmExtendFrameIntoClientArea(GetNativeView(), &margins); } diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 3ba3b5e..9df6216 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -956,8 +956,6 @@ void BrowserView::ContinueDraggingDetachedTab(const gfx::Rect& tab_bounds) { void BrowserView::UserChangedTheme() { frame_->GetWindow()->FrameTypeChanged(); - GetRootView()->ThemeChanged(); - GetRootView()->SchedulePaint(); } int BrowserView::GetExtraRenderViewHeight() const { -- cgit v1.1