Commit 491bc7c7 authored by Alexandre Julliard's avatar Alexandre Julliard

Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbeyj@wpi.edu>

Redraw toolbar button inside TOOLBAR_EnableButton() only if the state of the button changes. Stops flickering in toolbars caused by excessive redrawing.
parent 9d3845c5
......@@ -1566,20 +1566,29 @@ TOOLBAR_EnableButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
TBUTTON_INFO *btnPtr;
HDC hdc;
INT nIndex;
DWORD bState;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam);
if (nIndex == -1)
return FALSE;
btnPtr = &infoPtr->buttons[nIndex];
if (LOWORD(lParam) == FALSE)
btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED);
else
bState = btnPtr->fsState & TBSTATE_ENABLED;
/* update the toolbar button state */
if(LOWORD(lParam) == FALSE) {
btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED);
} else {
btnPtr->fsState |= TBSTATE_ENABLED;
}
hdc = GetDC (hwnd);
TOOLBAR_DrawButton (hwnd, btnPtr, hdc);
ReleaseDC (hwnd, hdc);
/* redraw the button only if the state of the button changed */
if(bState != (btnPtr->fsState & TBSTATE_ENABLED)) {
hdc = GetDC (hwnd);
TOOLBAR_DrawButton (hwnd, btnPtr, hdc);
ReleaseDC (hwnd, hdc);
}
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment