diff options
| author | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2020-06-06 11:54:18 +0200 |
|---|---|---|
| committer | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2020-06-06 11:54:18 +0200 |
| commit | 12ba6ccef311641c991c4bf1334627b27d8e263e (patch) | |
| tree | a246b34d1e97537ab5d9a6e09f8f23cad7d38076 | |
| parent | d607540dbaf8a0b2a24dceb27ebddddb420ffd0f (diff) | |
forward WM_SETTINGCHANGE and WM_SYSCOLORCHANGE to controls
| -rw-r--r-- | alf/alflayout.cpp | 22 | ||||
| -rw-r--r-- | alf/alftoplevel.cpp | 5 |
2 files changed, 24 insertions, 3 deletions
diff --git a/alf/alflayout.cpp b/alf/alflayout.cpp index 745b303..ba2854b 100644 --- a/alf/alflayout.cpp +++ b/alf/alflayout.cpp @@ -1056,6 +1056,28 @@ ALF_Layout_HandleMessage(ALFLayout *layout, HWND hwnd, UINT msg, WPARAM wparam, return TRUE; } + if (msg == WM_SYSCOLORCHANGE) { + // forward to children + ALF_FOR_LIST(ALFControlPriv, list, &layout->controls, c) { + SendMessage(c->hwnd, WM_SYSCOLORCHANGE, wparam, lparam); + } + + return FALSE; + } + + if (msg == WM_SETTINGCHANGE) { + // Controls could technically figure out if their layout parameters + // have changed, but that is not easy so nobody would bother anyway. + ALF_Layout_Invalidate(layout, hwnd); + + // forward to children + ALF_FOR_LIST(ALFControlPriv, list, &layout->controls, c) { + SendMessage(c->hwnd, WM_SETTINGCHANGE, wparam, lparam); + } + + return FALSE; + } + if (msg == ALF_WM_SETBGCOLOR) { *pRet = 1; if (layout->bgcolor == (ALFColor)lparam) diff --git a/alf/alftoplevel.cpp b/alf/alftoplevel.cpp index e2d2f64..5cdd686 100644 --- a/alf/alftoplevel.cpp +++ b/alf/alftoplevel.cpp @@ -397,10 +397,9 @@ ALF_Toplevel_DefWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) SetWindowPos(hwnd, NULL, r->left, r->top, r->right-r->left, r->bottom-r->top, SWP_NOACTIVATE|SWP_NOZORDER); } - if (msg == WM_THEMECHANGED || msg == WM_SETTINGCHANGE) { + if (msg == WM_THEMECHANGED || msg == WM_SETTINGCHANGE || msg == WM_SYSCOLORCHANGE) { ALF_Toplevel_HandleDpiOrSettingsChange(hwnd, priv); - ALF_InvalidateLayout(hwnd); - ALF_InvalidateBackground(hwnd); + ALF_InvalidateBackground(hwnd); // might be a system color, or theme stuff or whatever InvalidateRect(hwnd, NULL, TRUE); } |
