JBR-2667 Add new AWT desktop property for light/dark theme detection on Windows 10

(cherry picked from commit 0e4ad056dd)
(cherry picked from commit e5dfcc4417)
This commit is contained in:
Kirill Kirichenko
2020-08-18 14:12:37 +03:00
committed by jbrbot
parent 4561cbe176
commit 6adc1916da

View File

@@ -695,6 +695,20 @@ void AwtDesktopProperties::GetOtherParameters() {
}
free(value);
}
// Add property for light/dark theme detection
value = getWindowsPropFromReg(TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"),
TEXT("AppsUseLightTheme"), &valueType);
if (value != NULL) {
if (valueType == REG_DWORD) {
SetBooleanProperty(TEXT("win.darkTheme.on"), (BOOL)((int)*value == 0));
}
free(value);
}
else {
SetBooleanProperty(TEXT("win.darkTheme.on"), FALSE);
}
}
catch (std::bad_alloc&) {
if (value != NULL) {