From d3d2877b65f043def98ef51339dd1dc76aa6a0f7 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Sat, 4 Oct 2025 04:12:01 +0200 Subject: [PATCH] fix: accentColor set distinguishes the frame (#48449) * fix: accentColor set distinguishes the frame Co-authored-by: zoy * chore: invalid change Co-authored-by: zoy * fix: lint Co-authored-by: zoy --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: zoy --- shell/browser/native_window_views_win.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/shell/browser/native_window_views_win.cc b/shell/browser/native_window_views_win.cc index e5532ef4b45..8a48d00befe 100644 --- a/shell/browser/native_window_views_win.cc +++ b/shell/browser/native_window_views_win.cc @@ -31,15 +31,15 @@ namespace electron { namespace { -void SetWindowBorderAndCaptionColor(HWND hwnd, COLORREF color) { - if (base::win::GetVersion() < base::win::Version::WIN11) - return; +void SetWindowBorderAndCaptionColor(HWND hwnd, COLORREF color, bool has_frame) { + HRESULT result; + if (has_frame) { + result = + DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &color, sizeof(color)); - HRESULT result = - DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &color, sizeof(color)); - - if (FAILED(result)) - LOG(WARNING) << "Failed to set caption color"; + if (FAILED(result)) + LOG(WARNING) << "Failed to set caption color"; + } result = DwmSetWindowAttribute(hwnd, DWMWA_BORDER_COLOR, &color, sizeof(color)); @@ -591,7 +591,8 @@ void NativeWindowViews::UpdateWindowAccentColor(bool active) { } COLORREF final_color = border_color.value_or(DWMWA_COLOR_DEFAULT); - SetWindowBorderAndCaptionColor(GetAcceleratedWidget(), final_color); + SetWindowBorderAndCaptionColor(GetAcceleratedWidget(), final_color, + has_frame()); } void NativeWindowViews::SetAccentColor(