From 7030c5f78ae29404278df837b18f8ce86c5df6d8 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Tue, 23 May 2000 21:11:06 +0000 Subject: [PATCH] Reduce toolbar redrawing and flicker by calling RedrawWindow() in TOOLBAR_MouseMove() only if hot effect applies to the current hot button. Restore bHot flag of hot button in TOOLBAR_LButtonUp() to restore hot effect properly. --- dlls/comctl32/toolbar.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 68abeaf0334..b4a058687db 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -3159,6 +3159,10 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) pt.y = (INT)HIWORD(lParam); nHit = TOOLBAR_InternalHitTest (hwnd, &pt); + /* restore hot effect to hot button disabled by TOOLBAR_LButtonDown() */ + if(infoPtr->nHotItem >= 0) + infoPtr->buttons[infoPtr->nHotItem].bHot = TRUE; + if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) { infoPtr->bCaptured = FALSE; ReleaseCapture (); @@ -3317,10 +3321,14 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) btnPtr = &infoPtr->buttons[nHit]; btnPtr->bHot = TRUE; - RedrawWindow(hwnd,&btnPtr->rect,NULL, - RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); - infoPtr->nHotItem = nHit; + + /* only enabled buttons show hot effect */ + if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED) + { + RedrawWindow(hwnd,&btnPtr->rect,NULL, + RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); + } } if (infoPtr->bCaptured) {