1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-23 23:21:08 +01:00

Weather: Support for high contrast themes

This commit is contained in:
Valentin Radu 2022-02-17 23:06:24 +02:00
parent 087c3a674a
commit 668c234207
2 changed files with 26 additions and 5 deletions

View File

@ -4207,7 +4207,7 @@ __int64 __fastcall PeopleBand_DrawTextWithGlowHook(
}
else
{
rgbColor = GetSysColor(COLOR_WINDOWTEXT);
rgbColor = GetSysColor(COLOR_BTNTEXT);
}
HFONT hOldFont = SelectFont(hDC, hFont);
if (bEmptyData)

View File

@ -789,6 +789,24 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
{
if (IsColorSchemeChangeMessage(lParam))
{
MARGINS marGlassInset;
if (!IsHighContrast())
{
marGlassInset.cxLeftWidth = -1; // -1 means the whole window
marGlassInset.cxRightWidth = -1;
marGlassInset.cyBottomHeight = -1;
marGlassInset.cyTopHeight = -1;
}
else
{
marGlassInset.cxLeftWidth = 0;
marGlassInset.cxRightWidth = 0;
marGlassInset.cyBottomHeight = 0;
marGlassInset.cyTopHeight = 0;
}
DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);
BOOL value = (IsThemeActive() && !IsHighContrast()) ? 1 : 0;
DwmSetWindowAttribute(hWnd, 1029, &value, sizeof(BOOL));
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
if (!dwDarkMode)
{
@ -990,10 +1008,13 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
goto cleanup;
}
MARGINS marGlassInset = { -1, -1, -1, -1 }; // -1 means the whole window
DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);
BOOL value = 1;
DwmSetWindowAttribute(_this->hWnd, 1029, &value, sizeof(BOOL));
if (!IsHighContrast())
{
MARGINS marGlassInset = { -1, -1, -1, -1 }; // -1 means the whole window
DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);
BOOL value = 1;
DwmSetWindowAttribute(_this->hWnd, 1029, &value, sizeof(BOOL));
}
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);