forked from WinMerge/winmerge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Title bar background color and text color follow windows settings whe…
…n not customized (WinMerge#2505) (2) - Use accent color as titlebar color only if "Show accent color in title bars and window borders" is set to "On" in the Windows Settings > Personalization > Colors page. - For Windows XP support, I would like to avoid using DwmGetColorizationColor(). I would like to get accent color from registry. - WinMerge originally used COLOR_ACTIVECAPTION and COLOR_INACTIVECAPTION, but I don't want to use them as titlebar color because they are documented as unsupported in Windows 10 and later. - Move accent color related handling from CMDITabBar to CTitleBarHelper.
- Loading branch information
Showing
9 changed files
with
138 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2024 Takashi Sawanaka | ||
// SPDX-License-Identifier: BSL-1.0 | ||
/** | ||
* @file AccentColor.cpp | ||
* | ||
* @brief Implementation of the CAccentColor class | ||
*/ | ||
|
||
#include "StdAfx.h" | ||
#include "AccentColor.h" | ||
#include "RegKey.h" | ||
|
||
CAccentColor::CAccentColor() | ||
: m_accentColor(CLR_NONE) | ||
, m_accentColorInactive(CLR_NONE) | ||
, m_colorPrevalence(false) | ||
{ | ||
Reload(); | ||
} | ||
|
||
CAccentColor& CAccentColor::Get() | ||
{ | ||
static CAccentColor s_accentColor; | ||
return s_accentColor; | ||
} | ||
|
||
void CAccentColor::Reload() | ||
{ | ||
CRegKeyEx reg; | ||
if (ERROR_SUCCESS != reg.Open(HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Windows\\DWM"))) | ||
return; | ||
m_accentColor = reg.ReadDword(_T("AccentColor"), CLR_NONE); | ||
if (m_accentColor != CLR_NONE) | ||
m_accentColor &= 0xffffff; | ||
m_accentColorInactive = reg.ReadDword(_T("AccentColorInactive"), CLR_NONE); | ||
if (m_accentColorInactive != CLR_NONE) | ||
m_accentColorInactive &= 0xffffff; | ||
m_colorPrevalence = reg.ReadDword(_T("ColorPrevalence"), false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2024 Takashi Sawanaka | ||
// SPDX-License-Identifier: BSL-1.0 | ||
/** | ||
* @file AccentColor.h | ||
* | ||
* @brief Declaration file for CAccentColor class | ||
*/ | ||
|
||
class CAccentColor | ||
{ | ||
public: | ||
CAccentColor(); | ||
COLORREF GetAccentColor() const { return m_accentColor; }; | ||
COLORREF GetAccentColorInactive() const { return m_accentColorInactive; } | ||
bool GetColorPrevalence() const { return m_colorPrevalence; } | ||
void Reload(); | ||
static CAccentColor& Get(); | ||
private: | ||
COLORREF m_accentColor; | ||
COLORREF m_accentColorInactive; | ||
bool m_colorPrevalence; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters