fix: Windows native theme detection not working correctly
This commit is contained in:
parent
2c740cab06
commit
423e23e3c0
@ -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() {
|
||||||
|
@ -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>();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user