fix: accentColor set distinguishes the frame (#48405)

* fix: accentColor set distinguishes the frame

* chore: invalid change

* fix: lint
This commit is contained in:
zoy
2025-10-04 02:10:18 +08:00
committed by GitHub
parent 49c37b4daa
commit 7cb1552614

View File

@@ -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(