Fix trackbar draws incorrectly after changing style. For example, adding TBS_BOTH should cause a total repaint.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/comctl32/trackbar.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c index 1859cf0f516..ce6a20c6c63 100644 --- a/dlls/comctl32/trackbar.c +++ b/dlls/comctl32/trackbar.c @@ -1502,6 +1502,19 @@ TRACKBAR_InitializeThumb (TRACKBAR_INFO *infoPtr) return 0; }
+static void TRACKBAR_RecalculateAll (TRACKBAR_INFO *infoPtr) +{ + if (infoPtr->dwStyle & TBS_FIXEDLENGTH) + { + TRACKBAR_CalcChannel(infoPtr); + TRACKBAR_UpdateThumb(infoPtr); + } + else + { + TRACKBAR_InitializeThumb(infoPtr); + } + TRACKBAR_AlignBuddies(infoPtr); +}
static LRESULT TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs) @@ -1677,14 +1690,7 @@ TRACKBAR_SetFocus (TRACKBAR_INFO *infoPtr) static LRESULT TRACKBAR_Size (TRACKBAR_INFO *infoPtr) { - if (infoPtr->dwStyle & TBS_FIXEDLENGTH) - { - TRACKBAR_CalcChannel(infoPtr); - TRACKBAR_UpdateThumb(infoPtr); - } - else - TRACKBAR_InitializeThumb(infoPtr); - TRACKBAR_AlignBuddies (infoPtr); + TRACKBAR_RecalculateAll(infoPtr); TRACKBAR_InvalidateAll(infoPtr);
return 0; @@ -1697,7 +1703,8 @@ TRACKBAR_StyleChanged (TRACKBAR_INFO *infoPtr, WPARAM wStyleType, if (wStyleType != GWL_STYLE) return 0;
infoPtr->dwStyle = lpss->styleNew; - + TRACKBAR_RecalculateAll(infoPtr); + TRACKBAR_InvalidateAll(infoPtr); return 0; }