Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
win: minor tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Yuhang Zhao <[email protected]>
  • Loading branch information
wangwenx190 committed Oct 21, 2022
1 parent 53bf601 commit 9011623
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/utils_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,9 @@ void Utils::registerThemeChangeNotification()

void Utils::refreshWin32ThemeResources(const WId windowId, const bool dark)
{
// Code learned from the following repositories. Thank very much for their great effort!
// https://github.com/ysc3839/win32-darkmode/blob/master/win32-darkmode/DarkMode.h
// https://github.com/TortoiseGit/TortoiseGit/blob/master/src/TortoiseGitBlame/MainFrm.cpp
Q_ASSERT(windowId);
if (!windowId) {
return;
Expand Down Expand Up @@ -2159,7 +2162,9 @@ void Utils::refreshWin32ThemeResources(const WId windowId, const bool dark)
if (GetLastError() != ERROR_SUCCESS) {
WARNING << getSystemErrorMessage(kRefreshImmersiveColorPolicyState);
}
if (GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH) == FALSE) {
SetLastError(ERROR_SUCCESS);
Q_UNUSED(GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH));
if (GetLastError() != ERROR_SUCCESS) {
WARNING << getSystemErrorMessage(kGetIsImmersiveColorUsingHighContrast);
}
} else {
Expand Down Expand Up @@ -2190,7 +2195,9 @@ void Utils::refreshWin32ThemeResources(const WId windowId, const bool dark)
if (GetLastError() != ERROR_SUCCESS) {
WARNING << getSystemErrorMessage(kRefreshImmersiveColorPolicyState);
}
if (GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH) == FALSE) {
SetLastError(ERROR_SUCCESS);
Q_UNUSED(GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH));
if (GetLastError() != ERROR_SUCCESS) {
WARNING << getSystemErrorMessage(kGetIsImmersiveColorUsingHighContrast);
}
if (WindowsVersionHelper::isWin1019H1OrGreater()) {
Expand Down

0 comments on commit 9011623

Please sign in to comment.