Commit 9eb33c82 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Honour WM_SETREDRAW.

- Fix all calls of InvalidateRect.
parent ec132fe8
...@@ -1030,6 +1030,10 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps) ...@@ -1030,6 +1030,10 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
NMTBCUSTOMDRAW tbcd; NMTBCUSTOMDRAW tbcd;
DWORD ntfret; DWORD ntfret;
/* the app has told us not to redraw the toolbar */
if (!infoPtr->bDoRedraw)
return;
/* if imagelist belongs to the app, it can be changed /* if imagelist belongs to the app, it can be changed
by the app after setting it */ by the app after setting it */
if (GETDEFIMAGELIST(infoPtr, 0) != infoPtr->himlInt) if (GETDEFIMAGELIST(infoPtr, 0) != infoPtr->himlInt)
...@@ -2424,7 +2428,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -2424,7 +2428,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nNumBitmaps += nButtons; infoPtr->nNumBitmaps += nButtons;
} }
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, TRUE);
return nIndex; return nIndex;
} }
...@@ -2491,7 +2495,7 @@ TOOLBAR_AddButtonsA (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -2491,7 +2495,7 @@ TOOLBAR_AddButtonsA (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_DumpToolbar (infoPtr, __LINE__); TOOLBAR_DumpToolbar (infoPtr, __LINE__);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, TRUE);
return TRUE; return TRUE;
} }
...@@ -2559,7 +2563,7 @@ TOOLBAR_AddButtonsW (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -2559,7 +2563,7 @@ TOOLBAR_AddButtonsW (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_DumpToolbar (infoPtr, __LINE__); TOOLBAR_DumpToolbar (infoPtr, __LINE__);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, TRUE);
return TRUE; return TRUE;
} }
...@@ -2902,10 +2906,7 @@ TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -2902,10 +2906,7 @@ TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
if( bChecked != LOWORD(lParam) ) if( bChecked != LOWORD(lParam) )
{ {
if (nOldIndex != -1) if (nOldIndex != -1)
{ InvalidateRect(hwnd, &infoPtr->buttons[nOldIndex].rect, TRUE);
InvalidateRect(hwnd, &infoPtr->buttons[nOldIndex].rect,
TOOLBAR_HasText(infoPtr, &infoPtr->buttons[nOldIndex]));
}
InvalidateRect(hwnd, &btnPtr->rect, TRUE); InvalidateRect(hwnd, &btnPtr->rect, TRUE);
} }
...@@ -3042,10 +3043,7 @@ TOOLBAR_EnableButton (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -3042,10 +3043,7 @@ TOOLBAR_EnableButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* redraw the button only if the state of the button changed */ /* redraw the button only if the state of the button changed */
if(bState != (btnPtr->fsState & TBSTATE_ENABLED)) if(bState != (btnPtr->fsState & TBSTATE_ENABLED))
{ InvalidateRect(hwnd, &btnPtr->rect, TRUE);
InvalidateRect(hwnd, &btnPtr->rect,
TOOLBAR_HasText(infoPtr, btnPtr));
}
return TRUE; return TRUE;
} }
...@@ -3552,7 +3550,7 @@ TOOLBAR_Indeterminate (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -3552,7 +3550,7 @@ TOOLBAR_Indeterminate (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr->fsState |= TBSTATE_INDETERMINATE; btnPtr->fsState |= TBSTATE_INDETERMINATE;
if(oldState != btnPtr->fsState) if(oldState != btnPtr->fsState)
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); InvalidateRect(hwnd, &btnPtr->rect, TRUE);
return TRUE; return TRUE;
} }
...@@ -3945,7 +3943,7 @@ TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -3945,7 +3943,7 @@ TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->fsState |= TBSTATE_PRESSED;
if(oldState != btnPtr->fsState) if(oldState != btnPtr->fsState)
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); InvalidateRect(hwnd, &btnPtr->rect, TRUE);
return TRUE; return TRUE;
} }
...@@ -4049,7 +4047,7 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -4049,7 +4047,7 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE(" pos %d %d old bitmaps replaced by %d new ones.\n", TRACE(" pos %d %d old bitmaps replaced by %d new ones.\n",
pos, nOldBitmaps, nNewBitmaps); pos, nOldBitmaps, nNewBitmaps);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, TRUE);
return TRUE; return TRUE;
} }
...@@ -4392,7 +4390,7 @@ TOOLBAR_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -4392,7 +4390,7 @@ TOOLBAR_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_AutoSize(hwnd); TOOLBAR_AutoSize(hwnd);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, TRUE);
return (LRESULT)dwTemp; return (LRESULT)dwTemp;
} }
...@@ -4438,15 +4436,13 @@ TOOLBAR_SetHotItem (HWND hwnd, WPARAM wParam) ...@@ -4438,15 +4436,13 @@ TOOLBAR_SetHotItem (HWND hwnd, WPARAM wParam)
{ {
btnPtr = &infoPtr->buttons[(INT)wParam]; btnPtr = &infoPtr->buttons[(INT)wParam];
btnPtr->bHot = TRUE; btnPtr->bHot = TRUE;
InvalidateRect (hwnd, &btnPtr->rect, InvalidateRect (hwnd, &btnPtr->rect, TRUE);
TOOLBAR_HasText(infoPtr, btnPtr));
} }
if (nOldHotItem>=0) if (nOldHotItem>=0)
{ {
btnPtr = &infoPtr->buttons[nOldHotItem]; btnPtr = &infoPtr->buttons[nOldHotItem];
btnPtr->bHot = FALSE; btnPtr->bHot = FALSE;
InvalidateRect (hwnd, &btnPtr->rect, InvalidateRect (hwnd, &btnPtr->rect, TRUE);
TOOLBAR_HasText(infoPtr, btnPtr));
} }
} }
...@@ -4481,7 +4477,6 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -4481,7 +4477,6 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
hwnd, (INT)infoPtr->himlDef, infoPtr->nNumBitmaps, hwnd, (INT)infoPtr->himlDef, infoPtr->nNumBitmaps,
infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
/* FIXME: redraw ? */
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
return (LRESULT)himlTemp; return (LRESULT)himlTemp;
...@@ -4602,7 +4597,7 @@ TOOLBAR_SetRows (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -4602,7 +4597,7 @@ TOOLBAR_SetRows (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_CalcToolbar (hwnd); TOOLBAR_CalcToolbar (hwnd);
/* repaint toolbar */ /* repaint toolbar */
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, TRUE);
} }
/* return bounding rectangle */ /* return bounding rectangle */
...@@ -4634,7 +4629,7 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -4634,7 +4629,7 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam)
if ((btnPtr->fsState & TBSTATE_HIDDEN) != (LOWORD(lParam) & TBSTATE_HIDDEN)) { if ((btnPtr->fsState & TBSTATE_HIDDEN) != (LOWORD(lParam) & TBSTATE_HIDDEN)) {
btnPtr->fsState = LOWORD(lParam); btnPtr->fsState = LOWORD(lParam);
TOOLBAR_CalcToolbar (hwnd); TOOLBAR_CalcToolbar (hwnd);
InvalidateRect(hwnd, 0, TOOLBAR_HasText(infoPtr, btnPtr)); InvalidateRect(hwnd, 0, TRUE);
return TRUE; return TRUE;
} }
...@@ -4642,8 +4637,7 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -4642,8 +4637,7 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam)
if(btnPtr->fsState != LOWORD(lParam)) if(btnPtr->fsState != LOWORD(lParam))
{ {
btnPtr->fsState = LOWORD(lParam); btnPtr->fsState = LOWORD(lParam);
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, InvalidateRect(hwnd, &btnPtr->rect, TRUE);
btnPtr));
} }
return TRUE; return TRUE;
...@@ -4712,7 +4706,7 @@ TOOLBAR_SetColorScheme (HWND hwnd, LPCOLORSCHEME lParam) ...@@ -4712,7 +4706,7 @@ TOOLBAR_SetColorScheme (HWND hwnd, LPCOLORSCHEME lParam)
infoPtr->clrBtnHighlight = lParam->clrBtnHighlight; infoPtr->clrBtnHighlight = lParam->clrBtnHighlight;
infoPtr->clrBtnShadow = lParam->clrBtnShadow; infoPtr->clrBtnShadow = lParam->clrBtnShadow;
InvalidateRect(hwnd, 0, 0); InvalidateRect(hwnd, NULL, TRUE);
return 0; return 0;
} }
...@@ -4824,14 +4818,12 @@ TOOLBAR_Unkwn45E (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -4824,14 +4818,12 @@ TOOLBAR_Unkwn45E (HWND hwnd, WPARAM wParam, LPARAM lParam)
if ((INT)wParam >=0) { if ((INT)wParam >=0) {
btnPtr = &infoPtr->buttons[(INT)wParam]; btnPtr = &infoPtr->buttons[(INT)wParam];
btnPtr->bHot = (no_hi) ? FALSE : TRUE; btnPtr->bHot = (no_hi) ? FALSE : TRUE;
InvalidateRect (hwnd, &btnPtr->rect, InvalidateRect (hwnd, &btnPtr->rect, TRUE);
TOOLBAR_HasText(infoPtr, btnPtr));
} }
if (nOldHotItem>=0) { if (nOldHotItem>=0) {
btnPtr = &infoPtr->buttons[nOldHotItem]; btnPtr = &infoPtr->buttons[nOldHotItem];
btnPtr->bHot = FALSE; btnPtr->bHot = FALSE;
InvalidateRect (hwnd, &btnPtr->rect, InvalidateRect (hwnd, &btnPtr->rect, TRUE);
TOOLBAR_HasText(infoPtr, btnPtr));
} }
GetFocus(); GetFocus();
TRACE("old item=%d, new item=%d, flags=%08lx, notify=%d\n", TRACE("old item=%d, new item=%d, flags=%08lx, notify=%d\n",
...@@ -5156,8 +5148,7 @@ TOOLBAR_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5156,8 +5148,7 @@ TOOLBAR_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->fsState |= TBSTATE_PRESSED;
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, InvalidateRect(hwnd, &btnPtr->rect, TRUE);
btnPtr));
} }
else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE) else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE)
TOOLBAR_Customize (hwnd); TOOLBAR_Customize (hwnd);
...@@ -5226,7 +5217,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5226,7 +5217,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr->bHot = FALSE; btnPtr->bHot = FALSE;
if (btnPtr->fsState & TBSTATE_ENABLED) if (btnPtr->fsState & TBSTATE_ENABLED)
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); InvalidateRect(hwnd, &btnPtr->rect, TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
SetCapture (hwnd); SetCapture (hwnd);
...@@ -5297,10 +5288,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5297,10 +5288,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
if (nOldIndex != -1) if (nOldIndex != -1)
{ InvalidateRect(hwnd, &infoPtr->buttons[nOldIndex].rect, TRUE);
InvalidateRect(hwnd, &infoPtr->buttons[nOldIndex].rect,
TOOLBAR_HasText(infoPtr, &infoPtr->buttons[nOldIndex]));
}
/* /*
* now we can ReleaseCapture, which triggers CAPTURECHANGED msg, * now we can ReleaseCapture, which triggers CAPTURECHANGED msg,
...@@ -5363,8 +5351,7 @@ TOOLBAR_CaptureChanged(HWND hwnd) ...@@ -5363,8 +5351,7 @@ TOOLBAR_CaptureChanged(HWND hwnd)
infoPtr->nOldHit = -1; infoPtr->nOldHit = -1;
if (btnPtr->fsState & TBSTATE_ENABLED) if (btnPtr->fsState & TBSTATE_ENABLED)
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, InvalidateRect(hwnd, &btnPtr->rect, TRUE);
btnPtr));
} }
return 0; return 0;
} }
...@@ -5388,8 +5375,7 @@ TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5388,8 +5375,7 @@ TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam)
hotBtnPtr->bHot = FALSE; hotBtnPtr->bHot = FALSE;
rc1 = hotBtnPtr->rect; rc1 = hotBtnPtr->rect;
InflateRect (&rc1, 1, 1); InflateRect (&rc1, 1, 1);
InvalidateRect (hwnd, &rc1, TOOLBAR_HasText(infoPtr, InvalidateRect (hwnd, &rc1, TRUE);
hotBtnPtr));
} }
/* If the last button we were over is depressed then make it not */ /* If the last button we were over is depressed then make it not */
...@@ -5481,11 +5467,9 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5481,11 +5467,9 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* now invalidate the old and new buttons so they will be painted */ /* now invalidate the old and new buttons so they will be painted */
if (oldBtnPtr) if (oldBtnPtr)
InvalidateRect (hwnd, &oldBtnPtr->rect, InvalidateRect (hwnd, &oldBtnPtr->rect, TRUE);
TOOLBAR_HasText(infoPtr, oldBtnPtr));
if (btnPtr) if (btnPtr)
InvalidateRect(hwnd, &btnPtr->rect, InvalidateRect(hwnd, &btnPtr->rect, TRUE);
TOOLBAR_HasText(infoPtr, btnPtr));
if (infoPtr->bCaptured) { if (infoPtr->bCaptured) {
btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
...@@ -5934,7 +5918,7 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle) ...@@ -5934,7 +5918,7 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle)
TOOLBAR_AutoSize (hwnd); TOOLBAR_AutoSize (hwnd);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, TRUE);
return 0; return 0;
} }
......
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