From 00f14ee1f22a1c285462459f859fa17c90ccc19f Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 26 Oct 2019 22:51:10 +0100 Subject: [PATCH] [COMCTL32] Sync listview.c and progress.c with Wine Staging 4.18. CORE-16441 --- dll/win32/comctl32/listview.c | 154 +++++++++++++++++++++------------- dll/win32/comctl32/progress.c | 31 +++---- 2 files changed, 112 insertions(+), 73 deletions(-) diff --git a/dll/win32/comctl32/listview.c b/dll/win32/comctl32/listview.c index fb40d227df5..764a127f78b 100644 --- a/dll/win32/comctl32/listview.c +++ b/dll/win32/comctl32/listview.c @@ -124,9 +124,6 @@ * -- LVGroupComparE */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -145,7 +142,6 @@ #include "uxtheme.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(listview); @@ -211,6 +207,13 @@ typedef struct tagDELAYED_ITEM_EDIT INT iItem; } DELAYED_ITEM_EDIT; +enum notification_mask +{ + NOTIFY_MASK_ITEM_CHANGE = 0x1, + NOTIFY_MASK_END_LABEL_EDIT = 0x2, + NOTIFY_MASK_UNMASK_ALL = 0xffffffff +}; + typedef struct tagLISTVIEW_INFO { /* control window */ @@ -225,7 +228,7 @@ typedef struct tagLISTVIEW_INFO /* notification window */ SHORT notifyFormat; HWND hwndNotify; - BOOL bDoChangeNotify; /* send change notification messages? */ + DWORD notify_mask; UINT uCallbackMask; /* tooltips */ @@ -993,7 +996,7 @@ static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, UINT code, LPNMLVDISP } else if (return_unicode && (pdi->hdr.code == LVN_GETDISPINFOW)) { - strcpyW(ret_text, pdi->item.pszText); + lstrcpyW(ret_text, pdi->item.pszText); } else if (return_ansi) /* note : pointer can be changed by app ! */ { @@ -1311,21 +1314,19 @@ static inline void iterator_destroy(const ITERATOR *i) /*** * Create an empty iterator. */ -static inline BOOL iterator_empty(ITERATOR* i) +static inline void iterator_empty(ITERATOR* i) { ZeroMemory(i, sizeof(*i)); i->nItem = i->nSpecial = i->range.lower = i->range.upper = -1; - return TRUE; } /*** * Create an iterator over a range. */ -static inline BOOL iterator_rangeitems(ITERATOR* i, RANGE range) +static inline void iterator_rangeitems(ITERATOR* i, RANGE range) { iterator_empty(i); i->range = range; - return TRUE; } /*** @@ -1333,11 +1334,10 @@ static inline BOOL iterator_rangeitems(ITERATOR* i, RANGE range) * Please note that the iterator will take ownership of the ranges, * and will free them upon destruction. */ -static inline BOOL iterator_rangesitems(ITERATOR* i, RANGES ranges) +static inline void iterator_rangesitems(ITERATOR* i, RANGES ranges) { iterator_empty(i); i->ranges = ranges; - return TRUE; } /*** @@ -1347,12 +1347,16 @@ static inline BOOL iterator_rangesitems(ITERATOR* i, RANGES ranges) static BOOL iterator_frameditems_absolute(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *frame) { RECT rcItem, rcTemp; - - /* in case we fail, we want to return an empty iterator */ - if (!iterator_empty(i)) return FALSE; + RANGES ranges; TRACE("(frame=%s)\n", wine_dbgstr_rect(frame)); + /* in case we fail, we want to return an empty iterator */ + iterator_empty(i); + + if (infoPtr->nItemCount == 0) + return TRUE; + if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON) { INT nItem; @@ -1363,7 +1367,8 @@ static BOOL iterator_frameditems_absolute(ITERATOR* i, const LISTVIEW_INFO* info if (IntersectRect(&rcTemp, &rcItem, frame)) i->nSpecial = infoPtr->nFocusedItem; } - if (!(iterator_rangesitems(i, ranges_create(50)))) return FALSE; + if (!(ranges = ranges_create(50))) return FALSE; + iterator_rangesitems(i, ranges); /* to do better here, we need to have PosX, and PosY sorted */ TRACE("building icon ranges:\n"); for (nItem = 0; nItem < infoPtr->nItemCount; nItem++) @@ -1387,7 +1392,7 @@ static BOOL iterator_frameditems_absolute(ITERATOR* i, const LISTVIEW_INFO* info range.lower = max(frame->top / infoPtr->nItemHeight, 0); range.upper = min((frame->bottom - 1) / infoPtr->nItemHeight, infoPtr->nItemCount - 1) + 1; if (range.upper <= range.lower) return TRUE; - if (!iterator_rangeitems(i, range)) return FALSE; + iterator_rangeitems(i, range); TRACE(" report=%s\n", debugrange(&i->range)); } else @@ -1419,7 +1424,8 @@ static BOOL iterator_frameditems_absolute(ITERATOR* i, const LISTVIEW_INFO* info if (nLastCol < nFirstCol || nLastRow < nFirstRow) return TRUE; - if (!(iterator_rangesitems(i, ranges_create(nLastCol - nFirstCol + 1)))) return FALSE; + if (!(ranges = ranges_create(nLastCol - nFirstCol + 1))) return FALSE; + iterator_rangesitems(i, ranges); TRACE("building list ranges:\n"); for (nCol = nFirstCol; nCol <= nLastCol; nCol++) { @@ -1460,7 +1466,11 @@ static BOOL iterator_visibleitems(ITERATOR *i, const LISTVIEW_INFO *infoPtr, HDC INT rgntype; rgntype = GetClipBox(hdc, &rcClip); - if (rgntype == NULLREGION) return iterator_empty(i); + if (rgntype == NULLREGION) + { + iterator_empty(i); + return TRUE; + } if (!iterator_frameditems(i, infoPtr, &rcClip)) return FALSE; if (rgntype == SIMPLEREGION) return TRUE; @@ -1746,7 +1756,9 @@ static inline void LISTVIEW_InvalidateItem(const LISTVIEW_INFO *infoPtr, INT nIt { RECT rcBox; - if(!is_redrawing(infoPtr)) return; + if (!is_redrawing(infoPtr) || nItem < 0 || nItem >= infoPtr->nItemCount) + return; + LISTVIEW_GetItemBox(infoPtr, nItem, &rcBox); LISTVIEW_InvalidateRect(infoPtr, &rcBox); } @@ -1763,7 +1775,7 @@ static inline void LISTVIEW_InvalidateSubItem(const LISTVIEW_INFO *infoPtr, INT LISTVIEW_GetHeaderRect(infoPtr, nSubItem, &rcBox); rcBox.top = 0; rcBox.bottom = infoPtr->nItemHeight; - OffsetRect(&rcBox, Origin.x + Position.x, Origin.y + Position.y); + OffsetRect(&rcBox, Origin.x, Origin.y + Position.y); LISTVIEW_InvalidateRect(infoPtr, &rcBox); } @@ -1815,7 +1827,7 @@ static inline INT LISTVIEW_GetCountPerColumn(const LISTVIEW_INFO *infoPtr) { INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; - return max(nListHeight / infoPtr->nItemHeight, 1); + return infoPtr->nItemHeight ? max(nListHeight / infoPtr->nItemHeight, 1) : 0; } @@ -1873,7 +1885,7 @@ static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, L if (!charCode || !keyData || infoPtr->nItemCount == 0) return 0; /* only allow the valid WM_CHARs through */ - if (!isalnumW(charCode) && + if (!iswalnum(charCode) && charCode != '.' && charCode != '`' && charCode != '!' && charCode != '@' && charCode != '#' && charCode != '$' && charCode != '%' && charCode != '^' && charCode != '&' && @@ -3524,13 +3536,13 @@ Parameters: */ static void LISTVIEW_ShiftFocus(LISTVIEW_INFO *infoPtr, INT focus, INT item, INT direction) { - BOOL old_change = infoPtr->bDoChangeNotify; + DWORD old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE; - infoPtr->bDoChangeNotify = FALSE; + infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE; focus = shift_item(infoPtr, focus, item, direction); if (focus != infoPtr->nFocusedItem) LISTVIEW_SetItemFocus(infoPtr, focus); - infoPtr->bDoChangeNotify = old_change; + infoPtr->notify_mask |= old_mask; } /** @@ -3573,8 +3585,8 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) INT nLast = max(infoPtr->nSelectionMark, nItem); HWND hwndSelf = infoPtr->hwndSelf; NMLVODSTATECHANGE nmlv; + DWORD old_mask; LVITEMW item; - BOOL bOldChange; INT i; /* Temporarily disable change notification @@ -3582,8 +3594,9 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) * only one LVN_ODSTATECHANGED notification. * See MSDN documentation for LVN_ITEMCHANGED. */ - bOldChange = infoPtr->bDoChangeNotify; - if (infoPtr->dwStyle & LVS_OWNERDATA) infoPtr->bDoChangeNotify = FALSE; + old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE; + if (infoPtr->dwStyle & LVS_OWNERDATA) + infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE; if (nFirst == -1) nFirst = nItem; @@ -3602,7 +3615,7 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) notify_hdr(infoPtr, LVN_ODSTATECHANGED, (LPNMHDR)&nmlv); if (!IsWindow(hwndSelf)) return FALSE; - infoPtr->bDoChangeNotify = bOldChange; + infoPtr->notify_mask |= old_mask; return TRUE; } @@ -3621,9 +3634,9 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) { RANGES selection; + DWORD old_mask; LVITEMW item; ITERATOR i; - BOOL bOldChange; if (!(selection = ranges_create(100))) return; @@ -3673,8 +3686,9 @@ static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) /* disable per item notifications on LVS_OWNERDATA style FIXME: single LVN_ODSTATECHANGED should be used */ - bOldChange = infoPtr->bDoChangeNotify; - if (infoPtr->dwStyle & LVS_OWNERDATA) infoPtr->bDoChangeNotify = FALSE; + old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE; + if (infoPtr->dwStyle & LVS_OWNERDATA) + infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE; LISTVIEW_DeselectAllSkipItems(infoPtr, selection); @@ -3685,8 +3699,7 @@ static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) /* this will also destroy the selection */ iterator_destroy(&i); - infoPtr->bDoChangeNotify = bOldChange; - + infoPtr->notify_mask |= old_mask; LISTVIEW_SetItemFocus(infoPtr, nItem); } @@ -4265,8 +4278,11 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL memset(&nmlv, 0, sizeof(NMLISTVIEW)); nmlv.iItem = lpLVItem->iItem; - nmlv.uNewState = (item.state & ~stateMask) | (lpLVItem->state & stateMask); - nmlv.uOldState = item.state; + if (lpLVItem->mask & LVIF_STATE) + { + nmlv.uNewState = (item.state & ~stateMask) | (lpLVItem->state & stateMask); + nmlv.uOldState = item.state; + } nmlv.uChanged = uChanged ? uChanged : lpLVItem->mask; nmlv.lParam = item.lParam; @@ -4274,7 +4290,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL and we are _NOT_ virtual (LVS_OWNERDATA), and change notifications are enabled. Even nothing really changed we still need to send this, in this case uChanged mask is just set to passed item mask. */ - if(lpItem && !isNew && infoPtr->bDoChangeNotify) + if (lpItem && !isNew && (infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE)) { HWND hwndSelf = infoPtr->hwndSelf; @@ -4367,7 +4383,8 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL /* send LVN_ITEMCHANGED notification */ if (lpLVItem->mask & LVIF_PARAM) nmlv.lParam = lpLVItem->lParam; - if (infoPtr->bDoChangeNotify) notify_listview(infoPtr, LVN_ITEMCHANGED, &nmlv); + if (infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE) + notify_listview(infoPtr, LVN_ITEMCHANGED, &nmlv); return TRUE; } @@ -5265,11 +5282,15 @@ enddraw: /* Draw marquee rectangle if appropriate */ if (infoPtr->bMarqueeSelect) +#ifdef __REACTOS__ { SetBkColor(hdc, RGB(255, 255, 255)); SetTextColor(hdc, RGB(0, 0, 0)); DrawFocusRect(hdc, &infoPtr->marqueeDrawRect); } +#else + DrawFocusRect(hdc, &infoPtr->marqueeDrawRect); +#endif if (cdmode & CDRF_NOTIFYPOSTPAINT) notify_postpaint(infoPtr, &nmlvcd); @@ -5938,9 +5959,13 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL dispInfo.item.pszText = same ? NULL : pszText; dispInfo.item.cchTextMax = textlenT(dispInfo.item.pszText, isW); + infoPtr->notify_mask &= ~NOTIFY_MASK_END_LABEL_EDIT; + /* Do we need to update the Item Text */ res = notify_dispinfoT(infoPtr, LVN_ENDLABELEDITW, &dispInfo, isW); + infoPtr->notify_mask |= NOTIFY_MASK_END_LABEL_EDIT; + infoPtr->nEditLabelItem = -1; infoPtr->hwndEdit = 0; @@ -6409,7 +6434,7 @@ again: { if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING)) { - WCHAR *p = strstrW(lvItem.pszText, lpFindInfo->psz); + WCHAR *p = wcsstr(lvItem.pszText, lpFindInfo->psz); if (!p || p != lvItem.pszText) continue; } else @@ -9000,7 +9025,7 @@ static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *infoPtr, INT nItem, const LVITE if (nItem == -1) { UINT oldstate = 0; - BOOL notify; + DWORD old_mask; /* special case optimization for recurring attempt to deselect all */ if (lvItem.state == 0 && lvItem.stateMask == LVIS_SELECTED && !LISTVIEW_GetSelectedCount(infoPtr)) @@ -9013,10 +9038,10 @@ static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *infoPtr, INT nItem, const LVITE /* focus all isn't allowed */ if (lvItem.state & lvItem.stateMask & LVIS_FOCUSED) return FALSE; - notify = infoPtr->bDoChangeNotify; + old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE; if (infoPtr->dwStyle & LVS_OWNERDATA) { - infoPtr->bDoChangeNotify = FALSE; + infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE; if (!(lvItem.state & LVIS_SELECTED) && LISTVIEW_GetSelectedCount(infoPtr)) oldstate |= LVIS_SELECTED; if (infoPtr->nFocusedItem != -1) oldstate |= LVIS_FOCUSED; @@ -9030,7 +9055,7 @@ static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *infoPtr, INT nItem, const LVITE { NMLISTVIEW nmlv; - infoPtr->bDoChangeNotify = notify; + infoPtr->notify_mask |= old_mask; nmlv.iItem = -1; nmlv.iSubItem = 0; @@ -9514,7 +9539,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW * infoPtr->nHotItem = -1; infoPtr->redraw = TRUE; infoPtr->bNoItemMetrics = TRUE; - infoPtr->bDoChangeNotify = TRUE; + infoPtr->notify_mask = NOTIFY_MASK_UNMASK_ALL; infoPtr->autoSpacing = TRUE; infoPtr->iconSpacing.cx = GetSystemMetrics(SM_CXICONSPACING) - GetSystemMetrics(SM_CXICON); infoPtr->iconSpacing.cy = GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON); @@ -9909,7 +9934,7 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, /* carry on only if it really changed */ if (nNewScrollPos == nOldScrollPos) return 0; - if (infoPtr->hwndHeader) LISTVIEW_UpdateHeaderSize(infoPtr, nNewScrollPos); + LISTVIEW_UpdateHeaderSize(infoPtr, nNewScrollPos); /* now adjust to client coordinates */ nScrollDiff = nOldScrollPos - nNewScrollPos; @@ -9923,7 +9948,7 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) { - UINT pulScrollLines = 3; + INT pulScrollLines = 3; TRACE("(wheelDelta=%d)\n", wheelDelta); @@ -9952,8 +9977,8 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) { int cLineScroll; pulScrollLines = min((UINT)LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines); - cLineScroll = pulScrollLines * (float)infoPtr->cWheelRemainder / WHEEL_DELTA; - infoPtr->cWheelRemainder -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines; + cLineScroll = pulScrollLines * infoPtr->cWheelRemainder / WHEEL_DELTA; + infoPtr->cWheelRemainder -= WHEEL_DELTA * cLineScroll / pulScrollLines; LISTVIEW_VScroll(infoPtr, SB_INTERNAL, -cLineScroll); } break; @@ -10248,7 +10273,9 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN { if ((infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) && (lvHitTestInfo.flags & LVHT_ONITEMSTATEICON)) { + notify_click(infoPtr, NM_CLICK, &lvHitTestInfo); toggle_checkbox_state(infoPtr, nItem); + infoPtr->bLButtonDown = FALSE; return 0; } @@ -11099,13 +11126,21 @@ static void LISTVIEW_UpdateSize(LISTVIEW_INFO *infoPtr) infoPtr->rcList.bottom = max (infoPtr->rcList.bottom - 2, 0); } - /* if control created invisible header isn't created */ + /* When ListView control is created invisible, header isn't created right away. */ if (infoPtr->hwndHeader) { - HDLAYOUT hl; - WINDOWPOS wp; + POINT origin; + WINDOWPOS wp; + HDLAYOUT hl; + RECT rect; + + LISTVIEW_GetOrigin(infoPtr, &origin); - hl.prc = &infoPtr->rcList; + rect = infoPtr->rcList; + rect.left += origin.x; + rect.top += origin.y; + + hl.prc = ▭ hl.pwpos = ℘ SendMessageW( infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl ); TRACE(" wp.flags=0x%08x, wp=%d,%d (%dx%d)\n", wp.flags, wp.x, wp.y, wp.cx, wp.cy); @@ -11145,14 +11180,13 @@ static void LISTVIEW_UpdateSize(LISTVIEW_INFO *infoPtr) static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss) { - UINT uNewView = lpss->styleNew & LVS_TYPEMASK; - UINT uOldView = lpss->styleOld & LVS_TYPEMASK; + UINT uNewView, uOldView; UINT style; TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n", wStyleType, lpss->styleOld, lpss->styleNew); - if (wStyleType != GWL_STYLE) return 0; + if (wStyleType != GWL_STYLE || lpss->styleNew == infoPtr->dwStyle) return 0; infoPtr->dwStyle = lpss->styleNew; @@ -11164,6 +11198,9 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, ((lpss->styleNew & WS_VSCROLL) == 0)) ShowScrollBar(infoPtr->hwndSelf, SB_VERT, FALSE); + uNewView = lpss->styleNew & LVS_TYPEMASK; + uOldView = lpss->styleOld & LVS_TYPEMASK; + if (uNewView != uOldView) { HIMAGELIST himl; @@ -11949,8 +11986,9 @@ static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lP } case EN_KILLFOCUS: { - LISTVIEW_CancelEditLabel(infoPtr); - break; + if (infoPtr->notify_mask & NOTIFY_MASK_END_LABEL_EDIT) + LISTVIEW_CancelEditLabel(infoPtr); + break; } default: diff --git a/dll/win32/comctl32/progress.c b/dll/win32/comctl32/progress.c index 28d9fd2fd37..268bdac5da2 100644 --- a/dll/win32/comctl32/progress.c +++ b/dll/win32/comctl32/progress.c @@ -652,23 +652,24 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, case PBM_STEPIT: { - INT oldVal; - oldVal = infoPtr->CurVal; - infoPtr->CurVal += infoPtr->Step; - if (infoPtr->CurVal > infoPtr->MaxVal) - { - infoPtr->CurVal = (infoPtr->CurVal - infoPtr->MinVal) % (infoPtr->MaxVal - infoPtr->MinVal) + infoPtr->MinVal; - } - if (infoPtr->CurVal < infoPtr->MinVal) + int oldVal = infoPtr->CurVal; + + if (infoPtr->MinVal != infoPtr->MaxVal) { - infoPtr->CurVal = (infoPtr->CurVal - infoPtr->MinVal) % (infoPtr->MaxVal - infoPtr->MinVal) + infoPtr->MaxVal; + infoPtr->CurVal += infoPtr->Step; + if (infoPtr->CurVal > infoPtr->MaxVal) + infoPtr->CurVal = (infoPtr->CurVal - infoPtr->MinVal) % (infoPtr->MaxVal - infoPtr->MinVal) + infoPtr->MinVal; + if (infoPtr->CurVal < infoPtr->MinVal) + infoPtr->CurVal = (infoPtr->CurVal - infoPtr->MinVal) % (infoPtr->MaxVal - infoPtr->MinVal) + infoPtr->MaxVal; + + if (oldVal != infoPtr->CurVal) + { + TRACE("PBM_STEPIT: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal); + PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ); + UpdateWindow( infoPtr->Self ); + } } - if(oldVal != infoPtr->CurVal) - { - TRACE("PBM_STEPIT: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal); - PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ); - UpdateWindow( infoPtr->Self ); - } + return oldVal; } -- 2.17.1