mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-22 06:05:36 +08:00
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:
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user