1
0
mirror of synced 2024-11-12 10:10:53 +01:00

fix: Windows native theme detection not working correctly

This commit is contained in:
WerWolv 2022-08-08 11:22:59 +02:00
parent 2c740cab06
commit 423e23e3c0
2 changed files with 7 additions and 3 deletions

View File

@ -443,6 +443,7 @@ namespace hex {
s_systemThemeDetection = enabled;
EventManager::post<EventSettingsChanged>();
EventManager::post<EventOSThemeChanged>();
}
bool usesSystemThemeDetection() {

View File

@ -23,9 +23,10 @@ namespace hex::plugin::windows {
static void detectSystemTheme() {
// Setup system theme change detector
bool themeFollowSystem = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color") == 0;
EventManager::subscribe<EventOSThemeChanged>([themeFollowSystem] {
if (!themeFollowSystem) return;
EventManager::subscribe<EventOSThemeChanged>([] {
bool themeFollowSystem = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color") == 0;
if (!themeFollowSystem)
return;
HKEY hkey;
if (RegOpenKey(HKEY_CURRENT_USER, R"(Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)", &hkey) == ERROR_SUCCESS) {
@ -42,6 +43,8 @@ static void detectSystemTheme() {
});
EventManager::subscribe<EventWindowInitialized>([=] {
bool themeFollowSystem = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color") == 0;
if (themeFollowSystem)
EventManager::post<EventOSThemeChanged>();
});