1
0
mirror of synced 2024-11-13 18:50: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; s_systemThemeDetection = enabled;
EventManager::post<EventSettingsChanged>(); EventManager::post<EventSettingsChanged>();
EventManager::post<EventOSThemeChanged>();
} }
bool usesSystemThemeDetection() { bool usesSystemThemeDetection() {

View File

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