Skip to content

Commit

Permalink
Корректировка отрисовки заголовка основного окна в Windows 11 с отклю…
Browse files Browse the repository at this point in the history
…ченной опцией "Использовать темный заголовок".
  • Loading branch information
Aleksoid1978 committed Dec 15, 2024
1 parent a3b5ead commit f2d8c4f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
21 changes: 0 additions & 21 deletions src/apps/mplayerc/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
}

if (SysVersion::IsWin11orLater()) {
GetSystemTitleColor();
SetColorTitle();
}
else if (s.bUseDarkTheme && s.bDarkMenu && SysVersion::IsWin10v1809orLater()) {
Expand Down Expand Up @@ -19217,7 +19216,6 @@ void CMainFrame::OnSessionChange(UINT nSessionState, UINT nId)

void CMainFrame::OnSettingChange(UINT, LPCTSTR)
{
GetSystemTitleColor();
SetColorTitle(true);
}

Expand Down Expand Up @@ -20885,25 +20883,6 @@ void CMainFrame::OnUpdateRepeatForever(CCmdUI* pCmdUI)
}
}

void CMainFrame::GetSystemTitleColor()
{
if (SysVersion::IsWin11orLater()) {
m_colTitleBkSystem = 0x00FFFFFF;

CRegKey key;
if (ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM", KEY_READ)) {
DWORD prevalenceFlag = 0;
key.QueryDWORDValue(L"ColorPrevalence", prevalenceFlag);
if (prevalenceFlag) {
COLORREF dwAccentColor = {};
if (ERROR_SUCCESS == key.QueryDWORDValue(L"AccentColor", dwAccentColor)) {
m_colTitleBkSystem = dwAccentColor & 0x00FFFFFF;
}
}
}
}
}

void CMainFrame::SaveHistory()
{
auto& historyFile = AfxGetMyApp()->m_HistoryFile;
Expand Down
3 changes: 1 addition & 2 deletions src/apps/mplayerc/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ class CMainFrame : public CFrameWnd, public CDropTarget, public CDPI
HBRUSH m_hPopupMenuBrush = nullptr;

COLORREF m_colTitleBk = {};
COLORREF m_colTitleBkSystem = 0x00FFFFFF;
void GetSystemTitleColor();
const COLORREF m_colTitleBkSystem = 0xFFFFFFFF;

CMenu m_popupMainMenu;
CMenu m_popupMenu;
Expand Down

0 comments on commit f2d8c4f

Please sign in to comment.