ChHostSkinDark in Win32

This commit is contained in:
Mirek Fidler 2024-12-03 20:18:26 +01:00
parent 2cdbe62f0e
commit c31e9c473f
2 changed files with 24 additions and 3 deletions

View file

@ -9,6 +9,11 @@ void ChFlatSkin();
void ChFlatDarkSkin();
void ChFlatGraySkin();
#ifdef PLATFORM_WIN32
void ChHostSkinLight();
void ChHostSkinDark();
#endif
Vector<Tuple<void (*)(), String>> GetAllChSkins();
enum {

View file

@ -380,7 +380,7 @@ bool IsSystemThemeDark()
return GetEnv("UPP_DARKMODE__") == "1" ? !b : b;
}
void ChHostSkin()
void ChHostSkin0()
{
if(Ctrl::IsUHDEnabled()) {
HRESULT (STDAPICALLTYPE *SetProcessDpiAwareness)(int);
@ -395,8 +395,6 @@ void ChHostSkin()
}
}
sEmulateDarkTheme = Ctrl::IsDarkThemeEnabled() && IsSystemThemeDark() && !IsDark(Color::FromCR(GetSysColor(COLOR_WINDOW)));
NONCLIENTMETRICSW ncm;
#if (WINVER >= 0x0600 && !defined(__MINGW32_VERSION))
ncm.cbSize = sizeof(ncm) - sizeof(ncm.iPaddedBorderWidth); // WinXP does not like it...
@ -742,6 +740,24 @@ void ChHostSkin()
ChClassicSkin();
}
void ChHostSkin()
{
sEmulateDarkTheme = Ctrl::IsDarkThemeEnabled() && IsSystemThemeDark() && !IsDark(Color::FromCR(GetSysColor(COLOR_WINDOW)));
ChHostSkin0();
}
void ChHostSkinLight()
{
sEmulateDarkTheme = false;
ChHostSkin0();
}
void ChHostSkinDark()
{
sEmulateDarkTheme = true;
ChHostSkin0();
}
}
#endif