Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8149)

Unified Diff: chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc

Issue 2381283003: Have Chrome draw top window border when using custom titlebar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove default Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
index 406f558591156c6dcc7fb37d47dec0a7aa77d122..ba1ecb84674a4e16f176119cbf9aa3d1a1c27359 100644
--- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
+++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
@@ -101,7 +101,8 @@ bool BrowserDesktopWindowTreeHostWin::GetClientAreaInsets(
display::win::ScreenWin::GetSystemMetricsForHwnd(
GetHWND(), SM_CXSIZEFRAME);
// Reduce the Windows non-client border size because we extend the border
- // into our client area in UpdateDWMFrame().
+ // into our client area in UpdateDWMFrame(). The top inset must be 0 or
+ // else Windows will draw a full native titlebar outside the client area.
*insets = gfx::Insets(0, frame_thickness, frame_thickness,
frame_thickness) - GetClientEdgeThicknesses();
}
@@ -173,10 +174,10 @@ void BrowserDesktopWindowTreeHostWin::PostHandleMSG(UINT message,
// unless necessary to avoid flicker. This may be invoked during creation
// on XP and before the non_client_view has been created.
WINDOWPOS* window_pos = reinterpret_cast<WINDOWPOS*>(l_param);
- if (window_pos->flags & SWP_SHOWWINDOW &&
- GetWidget()->non_client_view()) {
- GetWidget()->non_client_view()->Layout();
- GetWidget()->non_client_view()->SchedulePaint();
+ views::NonClientView* non_client_view = GetWidget()->non_client_view();
+ if (window_pos->flags & SWP_SHOWWINDOW && non_client_view) {
+ non_client_view->Layout();
+ non_client_view->SchedulePaint();
}
break;
}
@@ -199,6 +200,13 @@ void BrowserDesktopWindowTreeHostWin::PostHandleMSG(UINT message,
}
break;
}
+ case WM_DWMCOLORIZATIONCOLORCHANGED: {
+ // The activation border may have changed color.
+ views::NonClientView* non_client_view = GetWidget()->non_client_view();
+ if (non_client_view)
+ non_client_view->SchedulePaint();
+ break;
+ }
}
}
@@ -250,20 +258,6 @@ void BrowserDesktopWindowTreeHostWin::FrameTypeChanged() {
// BrowserDesktopWindowTreeHostWin, private:
void BrowserDesktopWindowTreeHostWin::UpdateDWMFrame() {
- // With a custom titlebar we want the margins to always be 2 pixels, because
- // that gives us the 1 pixel accent color border around the window (a 1 pixel
- // margin is not sufficient, it will draw a messed-up-looking border instead).
- // The other pixel ends up being 1-pixel-thick native titlebar (including
- // caption buttons) but since we draw over that pixel in
- // GlassBrowserFrameView::PaintTitlebar() it will be invisible and won't get
- // mouse events.
- if (browser_frame_->CustomDrawSystemTitlebar() && ShouldUseNativeFrame() &&
- !GetWidget()->IsFullscreen()) {
- MARGINS margins = {2, 2, 2, 2};
- DwmExtendFrameIntoClientArea(GetHWND(), &margins);
- return;
- }
-
// For "normal" windows on Aero, we always need to reset the glass area
// correctly, even if we're not currently showing the native frame (e.g.
// because a theme is showing), so we explicitly check for that case rather
@@ -299,9 +293,9 @@ BrowserDesktopWindowTreeHostWin::GetClientEdgeThicknesses() const {
}
MARGINS BrowserDesktopWindowTreeHostWin::GetDWMFrameMargins() const {
- // If we're using the opaque frame or we're fullscreen we don't extend the
- // glass in at all because it won't be visible.
- if (!ShouldUseNativeFrame() || GetWidget()->IsFullscreen())
+ // Don't extend the glass in at all if it won't be visible.
+ if (!ShouldUseNativeFrame() || GetWidget()->IsFullscreen() ||
+ browser_frame_->CustomDrawSystemTitlebar())
return MARGINS{0};
// The glass should extend to the bottom of the tabstrip.
« no previous file with comments | « chrome/browser/themes/theme_service_win.cc ('k') | chrome/browser/ui/views/frame/glass_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698