fix: accentColor set distinguishes the frame (#48450)

* fix: accentColor set distinguishes the frame

Co-authored-by: zoy <zoy-l@outlook.com>

* chore: invalid change

Co-authored-by: zoy <zoy-l@outlook.com>

* fix: lint

Co-authored-by: zoy <zoy-l@outlook.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: zoy <zoy-l@outlook.com>
This commit is contained in:
trop[bot] 2025-10-03 15:31:36 -05:00 committed by GitHub
commit 81c17ef684
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,15 +31,15 @@ namespace electron {
namespace { namespace {
void SetWindowBorderAndCaptionColor(HWND hwnd, COLORREF color) { void SetWindowBorderAndCaptionColor(HWND hwnd, COLORREF color, bool has_frame) {
if (base::win::GetVersion() < base::win::Version::WIN11) HRESULT result;
return; if (has_frame) {
result =
DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &color, sizeof(color));
HRESULT result = if (FAILED(result))
DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &color, sizeof(color)); LOG(WARNING) << "Failed to set caption color";
}
if (FAILED(result))
LOG(WARNING) << "Failed to set caption color";
result = result =
DwmSetWindowAttribute(hwnd, DWMWA_BORDER_COLOR, &color, sizeof(color)); 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); COLORREF final_color = border_color.value_or(DWMWA_COLOR_DEFAULT);
SetWindowBorderAndCaptionColor(GetAcceleratedWidget(), final_color); SetWindowBorderAndCaptionColor(GetAcceleratedWidget(), final_color,
has_frame());
} }
void NativeWindowViews::SetAccentColor( void NativeWindowViews::SetAccentColor(