Only redraw button in PressButton and Indeterminate if its state has

changed.
This commit is contained in:
Huw Davies 2004-02-11 05:26:30 +00:00 committed by Alexandre Julliard
parent 9591679bf2
commit 951b0a2271
1 changed files with 8 additions and 2 deletions

View File

@ -3551,18 +3551,21 @@ TOOLBAR_Indeterminate (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
INT nIndex; INT nIndex;
DWORD oldState;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1) if (nIndex == -1)
return FALSE; return FALSE;
btnPtr = &infoPtr->buttons[nIndex]; btnPtr = &infoPtr->buttons[nIndex];
oldState = btnPtr->fsState;
if (LOWORD(lParam) == FALSE) if (LOWORD(lParam) == FALSE)
btnPtr->fsState &= ~TBSTATE_INDETERMINATE; btnPtr->fsState &= ~TBSTATE_INDETERMINATE;
else else
btnPtr->fsState |= TBSTATE_INDETERMINATE; btnPtr->fsState |= TBSTATE_INDETERMINATE;
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); if(oldState != btnPtr->fsState)
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr));
return TRUE; return TRUE;
} }
@ -3867,18 +3870,21 @@ TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
INT nIndex; INT nIndex;
DWORD oldState;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1) if (nIndex == -1)
return FALSE; return FALSE;
btnPtr = &infoPtr->buttons[nIndex]; btnPtr = &infoPtr->buttons[nIndex];
oldState = btnPtr->fsState;
if (LOWORD(lParam) == FALSE) if (LOWORD(lParam) == FALSE)
btnPtr->fsState &= ~TBSTATE_PRESSED; btnPtr->fsState &= ~TBSTATE_PRESSED;
else else
btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->fsState |= TBSTATE_PRESSED;
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); if(oldState != btnPtr->fsState)
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr));
return TRUE; return TRUE;
} }