diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-03 01:43:19 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-03 01:43:19 +0000 |
commit | b6f1c51a3af57cb6f63825f9fc8fb1e956a8023d (patch) | |
tree | 5bc07779e8d7703bb96ddc14aaddbe9cb6d27920 /chrome | |
parent | 9716e302e2ad262b2c20ff42ceac799d7c6e1f9b (diff) | |
download | chromium_src-b6f1c51a3af57cb6f63825f9fc8fb1e956a8023d.zip chromium_src-b6f1c51a3af57cb6f63825f9fc8fb1e956a8023d.tar.gz chromium_src-b6f1c51a3af57cb6f63825f9fc8fb1e956a8023d.tar.bz2 |
Fix some of the most egregious problems with Aero glass frames. These changes are basically hacks, but they're hacks that get our frame width, tabstrip layout (in non-OTR mode), and client edge drawing to exactly match pre-Magic-BrowzR code. In subsequent changes I will clean this all up to work better.
This also fixes windows refusing to become activated.
BUG=5054,6174
Review URL: http://codereview.chromium.org/19548
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9062 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/frame/aero_glass_frame.cc | 29 | ||||
-rw-r--r-- | chrome/browser/views/frame/aero_glass_non_client_view.cc | 31 |
2 files changed, 30 insertions, 30 deletions
diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc index 5694163..ccf11a0 100644 --- a/chrome/browser/views/frame/aero_glass_frame.cc +++ b/chrome/browser/views/frame/aero_glass_frame.cc @@ -17,12 +17,12 @@ // The width of the sizing borders. static const int kResizeBorder = 8; +// The width of the client edge to the left and right of the window. +static const int kWindowHorizontalClientEdgeWidth = 3; +// The height of the client edge to the bottom of the window. +static const int kWindowBottomClientEdgeHeight = 2; // By how much the toolbar overlaps with the tab strip. static const int kToolbarOverlapVertOffset = 5; -// This is the width of the default client edge provided by Windows. In some -// circumstances we provide our own client edge, so we use this width to -// remove it. -static const int kWindowsDWMBevelSize = 2; HICON AeroGlassFrame::throbber_icons_[AeroGlassFrame::kThrobberIconCount]; @@ -136,6 +136,7 @@ LRESULT AeroGlassFrame::OnNCActivate(BOOL active) { frame_initialized_ = true; } browser_view_->ActivationChanged(!!active); + SetMsgHandled(false); return TRUE; } @@ -155,9 +156,12 @@ LRESULT AeroGlassFrame::OnNCCalcSize(BOOL mode, LPARAM l_param) { // addition and subtraction in Layout(). We don't cut off the // top + titlebar as that prevents the window controls from // highlighting. - params->rgrc[0].left += kResizeBorder; - params->rgrc[0].right -= kResizeBorder; - params->rgrc[0].bottom -= kResizeBorder; + params->rgrc[0].left += + (kResizeBorder - kWindowHorizontalClientEdgeWidth); + params->rgrc[0].right -= + (kResizeBorder - kWindowHorizontalClientEdgeWidth); + params->rgrc[0].bottom -= + (kResizeBorder - kWindowBottomClientEdgeHeight); SetMsgHandled(TRUE); } else { @@ -210,15 +214,14 @@ void AeroGlassFrame::UpdateDWMFrame() { // bevel that aero renders to demarcate the client area. We supply our own // client edge for the browser window and detached popups, so we don't want // to show the default one. - int client_edge_left_width = kWindowsDWMBevelSize; - int client_edge_right_width = kWindowsDWMBevelSize; - int client_edge_bottom_height = kWindowsDWMBevelSize; - int client_edge_top_height = kWindowsDWMBevelSize; + int client_edge_left_width = kWindowHorizontalClientEdgeWidth + 1; + int client_edge_right_width = kWindowHorizontalClientEdgeWidth + 1; + int client_edge_bottom_height = kWindowBottomClientEdgeHeight + 1; + int client_edge_top_height = kWindowBottomClientEdgeHeight; if (browser_view_->IsTabStripVisible()) { gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view_->tabstrip()); - client_edge_top_height = - client_view()->y() + tabstrip_bounds.bottom(); + client_edge_top_height = tabstrip_bounds.bottom(); } // Now poke the DWM. diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index f50961a..1cbea04 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -93,7 +93,7 @@ SkBitmap AeroGlassNonClientView::distributor_logo_; // area of the window. static const int kNoTitleTopSpacing = 8; // The width of the client edge to the left and right of the window. -static const int kWindowHorizontalClientEdgeWidth = 2; +static const int kWindowHorizontalClientEdgeWidth = 3; // The height of the client edge to the bottom of the window. static const int kWindowBottomClientEdgeHeight = 2; // The horizontal distance between the left of the minimize button and the @@ -103,7 +103,10 @@ static const int kDistributorLogoHorizontalOffset = 7; // distributor logo. static const int kDistributorLogoVerticalOffset = 3; // The distance of the TabStrip from the top of the window's client area. -static const int kTabStripY = 14; +static const int kTabStripY = 19; +// How much space on the right is not used for the tab strip (to provide +// separation between the tabs and the window controls). +static const int kTabStripRightHorizOffset = 30; // A single pixel. static const int kPixel = 1; // The height of the sizing border. @@ -136,21 +139,15 @@ AeroGlassNonClientView::~AeroGlassNonClientView() { } gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { - // If we are maximized, the tab strip will be in line with the window - // controls, so we need to make sure they don't overlap. - int tabstrip_width = browser_view_->width() - otr_avatar_bounds_.width() - - kOTRAvatarIconTabStripSpacing; - if(frame_->IsMaximized()) { - TITLEBARINFOEX titlebar_info; - titlebar_info.cbSize = sizeof(TITLEBARINFOEX); - SendMessage(frame_->GetHWND(), WM_GETTITLEBARINFOEX, 0, - reinterpret_cast<WPARAM>(&titlebar_info)); - tabstrip_width = titlebar_info.rgrect[2].left; // Edge of minimize button - } - int tabstrip_height = tabstrip->GetPreferredHeight(); - int tabstrip_x = otr_avatar_bounds_.width() + kOTRAvatarIconTabStripSpacing; - int tabstrip_y = frame_->IsMaximized() ? 0 : kTabStripY; - return gfx::Rect(tabstrip_x, tabstrip_y, tabstrip_width, tabstrip_height); + int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? + (otr_avatar_bounds_.right() + kOTRAvatarIconTabStripSpacing) : + kWindowHorizontalClientEdgeWidth; + int tabstrip_width = width() - tabstrip_x - kTabStripRightHorizOffset - + (frame_->IsMaximized() ? frame_->GetMinimizeButtonOffset() : 0); + int tabstrip_y = + frame_->IsMaximized() ? (CalculateNonClientTopHeight() - 2) : kTabStripY; + return gfx::Rect(tabstrip_x, tabstrip_y, std::max(0, tabstrip_width), + tabstrip->GetPreferredHeight()); } /////////////////////////////////////////////////////////////////////////////// |