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

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: add include 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..c37a63b2bb4ae0a9b66d30464e8dab23e3678dfb 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
@@ -173,10 +173,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();
+ auto* 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 +199,13 @@ void BrowserDesktopWindowTreeHostWin::PostHandleMSG(UINT message,
}
break;
}
+ case WM_DWMCOLORIZATIONCOLORCHANGED: {
+ auto* non_client_view = GetWidget()->non_client_view();
+ // Activation border may have changed color.
Peter Kasting 2016/10/06 08:02:47 Grammar Nazi Nit: Add "The" in front
+ if (non_client_view)
+ non_client_view->SchedulePaint();
+ break;
+ }
}
}
@@ -250,20 +257,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 +292,10 @@ 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())
+ // If we're using the opaque frame or custom titlebar or we're fullscreen we
+ // don't extend the glass in at all because it won't be visible.
Peter Kasting 2016/10/06 08:02:47 Nit: Clearer (to me): Don't extend the DWM frame
Bret 2016/10/06 20:48:10 Not quite accurate because DWM still draws non-cli
Peter Kasting 2016/10/11 20:01:38 What about: Don't extend the DWM frame in unless
Bret 2016/10/11 20:48:19 Okay, I agree about not restating the code. Maybe
Peter Kasting 2016/10/11 20:56:51 I like your simple comment suggestion.
+ if (!ShouldUseNativeFrame() || GetWidget()->IsFullscreen() ||
+ browser_frame_->CustomDrawSystemTitlebar())
return MARGINS{0};
// The glass should extend to the bottom of the tabstrip.

Powered by Google App Engine
This is Rietveld 408576698