Browse Source

Weather: Support for high contrast themes

pull/886/head
Valentin Radu 4 years ago
parent
commit
668c234207
  1. 2
      ExplorerPatcher/dllmain.c
  2. 21
      ep_weather_host/ep_weather_host.c

2
ExplorerPatcher/dllmain.c

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

21
ep_weather_host/ep_weather_host.c

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

Loading…
Cancel
Save