From 079fdbf1a553e314cbba386b85ca92b67c61b8df Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Mon, 20 Apr 2020 17:18:20 +0200 Subject: fixup transparent background work and add test in widgetfactory Win32s bites once again with its 16bit WPARAM --- alf/alfpanel.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'alf/alfpanel.cpp') diff --git a/alf/alfpanel.cpp b/alf/alfpanel.cpp index eb954ec..7e109bb 100644 --- a/alf/alfpanel.cpp +++ b/alf/alfpanel.cpp @@ -73,11 +73,12 @@ ALF_Panel_DefWindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam) } if (msg == ALF_WM_SETBGCOLOR) { - priv->bgcolor = (ALFColor)wparam; + priv->bgcolor = (ALFColor)lparam; InvalidateRect(window, NULL, TRUE); // fallthrough to layout, will propagate color to children + // and invalidate the background of transparent children } if (msg == WM_GETFONT) { @@ -121,6 +122,15 @@ ALF_Panel_DefWindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam) ALF_Layout_Apply(&priv->layout, window); } + if (msg == ALF_WM_BACKGROUNDCHANGE) { + if (priv->bgcolor != ALF_COLOR_TRANSPARENT) + return 0; // nothing to do here, background is our own solid color + + InvalidateRect(window, NULL, TRUE); + + // fallthrough to layout, will propagate to transparent children + } + LRESULT ret = 0; if (ALF_Layout_HandleMessage(&priv->layout, window, msg, wparam, lparam, &ret)) return ret; @@ -200,7 +210,7 @@ ALF_AddPanel(HWND parent, WORD id, int x, int y) { HWND hwndPanel = ALF_CreatePanelWindow(parent, id); - ALF_AddWidget(parent, x, y, hwndPanel, 0, 0, ALF_LAYOUT_SIZE_QUERY | ALF_LAYOUT_INHERITFONT | ALF_LAYOUT_INHERITBGCOLOR); + ALF_AddWidget(parent, x, y, hwndPanel, 0, 0, ALF_LAYOUT_SIZE_QUERY | ALF_LAYOUT_INHERITFONT | ALF_LAYOUT_INHERITBGCOLOR | ALF_LAYOUT_SENDBGCHANGE); return hwndPanel; } -- cgit v1.2.3