[PATCH 20/20] comctl32: Update progress bar only if it moves
Maarten Lankhorst
m.b.lankhorst at gmail.com
Mon Mar 14 11:13:54 CDT 2011
---
dlls/comctl32/progress.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c
index 71fba9d..342ea83 100644
--- a/dlls/comctl32/progress.c
+++ b/dlls/comctl32/progress.c
@@ -139,9 +139,20 @@ static inline int get_bar_position( const PROGRESS_INFO *infoPtr, LONG style,
* Don't be too clever about invalidating the progress bar.
* InstallShield depends on this simple behaviour.
*/
-static void PROGRESS_Invalidate( const PROGRESS_INFO *infoPtr, INT old, INT new )
+static BOOL PROGRESS_Invalidate( const PROGRESS_INFO *infoPtr, INT old, INT new )
{
+ DWORD style = GetWindowLongW( infoPtr->Self, GWL_STYLE );
+ RECT rect;
+ int oldpos;
+ int newpos;
+ GetClientRect (infoPtr->Self, &rect);
+
+ oldpos = get_bar_position( infoPtr, style, &rect, old );
+ newpos = get_bar_position( infoPtr, style, &rect, new );
+ if (oldpos == newpos)
+ return FALSE;
InvalidateRect( infoPtr->Self, NULL, old > new );
+ return TRUE;
}
/* Information for a progress bar drawing helper */
@@ -626,8 +637,8 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
infoPtr->CurVal += (INT)wParam;
PROGRESS_CoercePos (infoPtr);
TRACE("PBM_DELTAPOS: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal);
- PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal );
- UpdateWindow( infoPtr->Self );
+ if (PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ))
+ UpdateWindow( infoPtr->Self );
}
return oldVal;
}
@@ -640,8 +651,8 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
infoPtr->CurVal = (INT)wParam;
PROGRESS_CoercePos(infoPtr);
TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal);
- PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal );
- UpdateWindow( infoPtr->Self );
+ if (PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ))
+ UpdateWindow( infoPtr->Self );
}
return oldVal;
}
@@ -670,8 +681,8 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
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 (PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ))
+ UpdateWindow( infoPtr->Self );
}
return oldVal;
}
--
1.7.2.3
--------------060208030207030505030809--
More information about the wine-patches
mailing list