Commit a4591933 authored by Chris Morgan's avatar Chris Morgan Committed by Alexandre Julliard

Changed RedrawWindow()'s to InvalidateRect()'s. RedrawWindow() was

being called with RDW_UPDATENOW, forcing immediate painting. Added redrawing logic to STATUSBAR_SetTextW().
parent 36c8db8c
...@@ -845,7 +845,7 @@ DATETIME_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -845,7 +845,7 @@ DATETIME_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
if(infoPtr->bCalDepressed == TRUE) { if(infoPtr->bCalDepressed == TRUE) {
infoPtr->bCalDepressed = FALSE; infoPtr->bCalDepressed = FALSE;
RedrawWindow(hwnd, &(infoPtr->calbutton), 0, RDW_ERASE|RDW_INVALIDATE); InvalidateRect(hwnd, &(infoPtr->calbutton), TRUE);
} }
return 0; return 0;
......
...@@ -1324,15 +1324,13 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1324,15 +1324,13 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
MONTHCAL_CopyTime(&ht.st, &selArray[1]); MONTHCAL_CopyTime(&ht.st, &selArray[1]);
MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray);
/* FIXME: for some reason if RedrawWindow has a NULL instead of zero it gives */
/* a compiler warning */
/* redraw both old and new days if the selected day changed */ /* redraw both old and new days if the selected day changed */
if(infoPtr->curSelDay != ht.st.wDay) { if(infoPtr->curSelDay != ht.st.wDay) {
MONTHCAL_CalcPosFromDay(infoPtr, ht.st.wDay, ht.st.wMonth, &rcDay); MONTHCAL_CalcPosFromDay(infoPtr, ht.st.wDay, ht.st.wMonth, &rcDay);
RedrawWindow(hwnd, &rcDay, 0, RDW_ERASE|RDW_INVALIDATE); InvalidateRect(hwnd, &rcDay, TRUE);
MONTHCAL_CalcPosFromDay(infoPtr, infoPtr->curSelDay, infoPtr->currentMonth, &rcDay); MONTHCAL_CalcPosFromDay(infoPtr, infoPtr->curSelDay, infoPtr->currentMonth, &rcDay);
RedrawWindow(hwnd, &rcDay, 0, RDW_ERASE|RDW_INVALIDATE); InvalidateRect(hwnd, &rcDay, TRUE);
} }
infoPtr->firstSelDay = ht.st.wDay; infoPtr->firstSelDay = ht.st.wDay;
...@@ -1487,7 +1485,7 @@ done: ...@@ -1487,7 +1485,7 @@ done:
/* only redraw if the currently selected day changed */ /* only redraw if the currently selected day changed */
/* FIXME: this should specify a rectangle containing only the days that changed */ /* FIXME: this should specify a rectangle containing only the days that changed */
/* using RedrawWindow */ /* using InvalidateRect */
if(oldselday != infoPtr->curSelDay) if(oldselday != infoPtr->curSelDay)
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
* FIXME/TODO * FIXME/TODO
* 1) Don't hard code bar to bottom of window, allow CCS_TOP also. * 1) Don't hard code bar to bottom of window, allow CCS_TOP also.
* 2) Tooltip support (almost done). * 2) Tooltip support (almost done).
* 3) I think RedrawWindow() is rather wrong, we should use InvalidateRect
* probably.
*/ */
#include "winbase.h" #include "winbase.h"
...@@ -217,7 +215,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc) ...@@ -217,7 +215,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc)
hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont); hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
if (infoPtr->simple) { if (infoPtr->simple) {
STATUSBAR_RefreshPart (hwnd, &infoPtr->part0,hdc,0); STATUSBAR_RefreshPart (hwnd, &infoPtr->part0, hdc, 0);
} else { } else {
for (i = 0; i < infoPtr->numParts; i++) { for (i = 0; i < infoPtr->numParts; i++) {
if (infoPtr->parts[i].style & SBT_OWNERDRAW) { if (infoPtr->parts[i].style & SBT_OWNERDRAW) {
...@@ -232,7 +230,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc) ...@@ -232,7 +230,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc)
SendMessageA (GetParent (hwnd), WM_DRAWITEM, SendMessageA (GetParent (hwnd), WM_DRAWITEM,
(WPARAM)dis.CtlID, (LPARAM)&dis); (WPARAM)dis.CtlID, (LPARAM)&dis);
} else } else
STATUSBAR_RefreshPart (hwnd, &infoPtr->parts[i], hdc,i); STATUSBAR_RefreshPart (hwnd, &infoPtr->parts[i], hdc, i);
} }
} }
...@@ -518,7 +516,7 @@ STATUSBAR_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -518,7 +516,7 @@ STATUSBAR_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
oldBkColor = self->clrBk; oldBkColor = self->clrBk;
self->clrBk = (COLORREF)lParam; self->clrBk = (COLORREF)lParam;
RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW); InvalidateRect(hwnd, NULL, FALSE);
return oldBkColor; return oldBkColor;
} }
...@@ -540,16 +538,14 @@ STATUSBAR_SetIcon (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -540,16 +538,14 @@ STATUSBAR_SetIcon (HWND hwnd, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
self->part0.hIcon = (HICON)lParam; self->part0.hIcon = (HICON)lParam;
if (self->simple) if (self->simple)
RedrawWindow(hwnd, &self->part0.bound,(HRGN)NULL, InvalidateRect(hwnd, &self->part0.bound, FALSE);
RDW_INVALIDATE|RDW_UPDATENOW);
} else { } else {
if (self->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */ if (self->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */
return TRUE; return TRUE;
self->parts[nPart].hIcon = (HICON)lParam; self->parts[nPart].hIcon = (HICON)lParam;
if (!(self->simple)) if (!(self->simple))
RedrawWindow(hwnd,&self->parts[nPart].bound,(HRGN)NULL, InvalidateRect(hwnd, &self->parts[nPart].bound, FALSE);
RDW_INVALIDATE|RDW_UPDATENOW);
} }
return TRUE; return TRUE;
} }
...@@ -652,7 +648,7 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -652,7 +648,7 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
} }
STATUSBAR_SetPartBounds (hwnd); STATUSBAR_SetPartBounds (hwnd);
RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW); InvalidateRect(hwnd, NULL, FALSE);
return TRUE; return TRUE;
} }
...@@ -710,7 +706,7 @@ STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -710,7 +706,7 @@ STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
COMCTL32_Free (part->text); COMCTL32_Free (part->text);
part->text = ntext; part->text = ntext;
} }
RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW); InvalidateRect(hwnd, &part->bound, FALSE);
return TRUE; return TRUE;
} }
...@@ -723,6 +719,7 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -723,6 +719,7 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
INT part_num, style, len; INT part_num, style, len;
LPWSTR text; LPWSTR text;
BOOL bRedraw = FALSE;
text = (LPWSTR) lParam; text = (LPWSTR) lParam;
part_num = ((INT) wParam) & 0x00ff; part_num = ((INT) wParam) & 0x00ff;
...@@ -734,23 +731,36 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -734,23 +731,36 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
part = &self->parts[part_num]; part = &self->parts[part_num];
if (!part) return FALSE; if (!part) return FALSE;
if (!(part->style & SBT_OWNERDRAW) && part->text) if(part->style != style)
COMCTL32_Free (part->text); bRedraw = TRUE;
part->text = 0;
/* FIXME: add "no need to redraw logic" */ part->style = style;
if (style & SBT_OWNERDRAW) {
/* FIXME: not sure how/if we can check for change in string with ownerdraw(remove this if we can't)... */
if (style & SBT_OWNERDRAW)
{
part->text = text; part->text = text;
} else { bRedraw = TRUE;
/* duplicate string */ } else if(!text)
if (text && (len = lstrlenW(text))) { {
part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); if(part->text)
strcpyW(part->text, text); {
} COMCTL32_Free(part->text);
bRedraw = TRUE;
}
part->text = 0;
} else if(!part->text || strcmpW(part->text, text)) /* see if the new string differs from the existing string */
{
if(part->text) COMCTL32_Free(part->text);
len = lstrlenW(text);
part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
strcpyW(part->text, text);
bRedraw = TRUE;
} }
part->style = style;
RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW); if(bRedraw)
InvalidateRect(hwnd, &part->bound, FALSE);
return TRUE; return TRUE;
} }
...@@ -827,7 +837,7 @@ STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -827,7 +837,7 @@ STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID); nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmhdr.code = SBN_SIMPLEMODECHANGE; nmhdr.code = SBN_SIMPLEMODECHANGE;
SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr); SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW); InvalidateRect(hwnd, NULL, FALSE);
return TRUE; return TRUE;
} }
...@@ -922,7 +932,7 @@ STATUSBAR_WMCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -922,7 +932,7 @@ STATUSBAR_WMCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
GetClientRect (GetParent (hwnd), &rect); GetClientRect (GetParent (hwnd), &rect);
width = rect.right - rect.left; width = rect.right - rect.left;
self->height = self->textHeight + 4 + VERT_BORDER; self->height = self->textHeight + 4 + VERT_BORDER;
MoveWindow (hwnd, lpCreate->x, lpCreate->y-1, MoveWindow (hwnd, lpCreate->x, lpCreate->y - 1,
width, self->height, FALSE); width, self->height, FALSE);
STATUSBAR_SetPartBounds (hwnd); STATUSBAR_SetPartBounds (hwnd);
...@@ -1061,8 +1071,7 @@ STATUSBAR_WMSetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1061,8 +1071,7 @@ STATUSBAR_WMSetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->hFont = (HFONT)wParam; infoPtr->hFont = (HFONT)wParam;
if (LOWORD(lParam) == TRUE) if (LOWORD(lParam) == TRUE)
RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL, InvalidateRect(hwnd, NULL, FALSE);
RDW_INVALIDATE|RDW_UPDATENOW);
return 0; return 0;
} }
...@@ -1096,7 +1105,7 @@ STATUSBAR_WMSetText (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1096,7 +1105,7 @@ STATUSBAR_WMSetText (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
} }
RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW); InvalidateRect(hwnd, &part->bound, FALSE);
return TRUE; 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