From 479d1226faaa937ef6820b14f36099ef3f575883 Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Sat, 18 Apr 2020 17:34:55 +0200 Subject: implement background color reduce flickering by keeping pixels if we know the background didn't change panel text is now gone, it would require us to redraw every transparent widget on top, which is a bad tradeoff since that panel text isn't very useful anyway. --- alf/alflabel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'alf/alflabel.cpp') diff --git a/alf/alflabel.cpp b/alf/alflabel.cpp index 59c92fa..f424486 100644 --- a/alf/alflabel.cpp +++ b/alf/alflabel.cpp @@ -203,6 +203,19 @@ ALF__LabelWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ReleaseDC(hwnd, hdcLabel); } + } else if (uMsg == WM_WINDOWPOSCHANGED) { + WINDOWPOS *p = (WINDOWPOS *)lParam; + if (!(p->flags & SWP_NOSIZE)) { + // for left-top aligned labels, no redraw is necessary + // right/bottom/center alignment basically needs to redraw the whole thing + DWORD halign = priv->style & ALF_LABEL_HALIGN_MASK; + DWORD valign = priv->style & ALF_LABEL_VALIGN_MASK; + + if ((halign != ALF_LABEL_ALIGN_LEFT && halign != ALF_LABEL_ALIGN_LEFT_LIKE_EDIT) + || (valign != ALF_LABEL_ALIGN_TOP && valign != ALF_LABEL_ALIGN_TOP_LIKE_EDIT)) { + InvalidateRect(hwnd, NULL, TRUE); + } + } } else if (uMsg == WM_DESTROY) { ALF_Free(priv); SetWindowLongPtr(hwnd, 0, 0); -- cgit v1.2.3