diff --git a/WeaselIPCServer/WeaselServerImpl.cpp b/WeaselIPCServer/WeaselServerImpl.cpp index de950f460..e9688cf2a 100644 --- a/WeaselIPCServer/WeaselServerImpl.cpp +++ b/WeaselIPCServer/WeaselServerImpl.cpp @@ -60,9 +60,11 @@ void ServerImpl::_Finailize() LRESULT ServerImpl::OnColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - if(IsUserDarkMode() != m_darkMode) { - m_darkMode = IsUserDarkMode(); - m_pRequestHandler->UpdateColorTheme(m_darkMode); + if (uMsg == WM_SETTINGCHANGE && (std::wstring((wchar_t*)lParam) == L"ImmersiveColorSet") || uMsg == WM_DWMCOLORIZATIONCOLORCHANGED) { + if (IsUserDarkMode() != m_darkMode) { + m_darkMode = IsUserDarkMode(); + m_pRequestHandler->UpdateColorTheme(m_darkMode); + } } return 0; } diff --git a/WeaselIPCServer/WeaselServerImpl.h b/WeaselIPCServer/WeaselServerImpl.h index 930780d4c..b07bccd0f 100644 --- a/WeaselIPCServer/WeaselServerImpl.h +++ b/WeaselIPCServer/WeaselServerImpl.h @@ -28,6 +28,7 @@ namespace weasel MESSAGE_HANDLER(WM_QUERYENDSESSION, OnQueryEndSystemSession) MESSAGE_HANDLER(WM_ENDSESSION, OnEndSystemSession) MESSAGE_HANDLER(WM_DWMCOLORIZATIONCOLORCHANGED, OnColorChange) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnColorChange) MESSAGE_HANDLER(WM_COMMAND, OnCommand) END_MSG_MAP()