Factor out wxIsSystemColourChange() helper function

Check whether the LPARAM of WM_SETTINGCHANGE is "ImmersiveColorSet".

No real changes yet, just make it possible to reuse this in the upcoming
commits.
This commit is contained in:
Vadim Zeitlin
2026-06-07 18:14:58 +02:00
parent f12b247d26
commit 92254ce2db
2 changed files with 16 additions and 6 deletions
+15
View File
@@ -1165,6 +1165,21 @@ inline wxLayoutDirection wxGetEditLayoutDirection(WXHWND hWnd)
: wxLayout_LeftToRight;
}
// Check if WM_SETTINGCHANGE notifies about the system colours change.
inline bool wxIsSystemColourChange(LPARAM lParam)
{
// Note that "ImmersiveColorSet" is set both when switching between
// light and dark themes and also when changing high contrast mode,
// for which an additional message with "WindowsThemeElement" is
// also sent, but we don't need to check for it as handling this
// one is enough
if ( !lParam )
return false;
auto* const what = reinterpret_cast<const TCHAR*>(lParam);
return wxStrcmp(what, wxT("ImmersiveColorSet")) == 0;
}
// ----------------------------------------------------------------------------
// functions mapping HWND to wxWindow
// ----------------------------------------------------------------------------
+1 -6
View File
@@ -3566,12 +3566,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
case WM_SETTINGCHANGE:
// Check for the special case of the message which notifies about
// the colours change.
// Note that "ImmersiveColorSet" is set both when switching between
// light and dark themes and also when changing high contrast mode,
// for which an additional message with "WindowsThemeElement" is
// also sent, but we don't need to check for it as handling this
// one is enough
if ( lParam && wxStrcmp((TCHAR*)lParam, wxT("ImmersiveColorSet")) == 0 )
if ( wxIsSystemColourChange(lParam) )
processed = HandleSysColorChange();
else
processed = HandleSettingChange(wParam, lParam);