- Rewrite NtUserGetUpdateRect. It should return TRUE when the window needs to be pained, not only when the client update rect is non-empty.

- Return TRUE for windows with pending WM_NCPAINT message in IntIsWindowDirty.

svn path=/trunk/; revision=14342
This commit is contained in:
Filip Navara 2005-03-27 08:29:25 +00:00
parent 212b767a54
commit e332bc75f9

View file

@ -537,7 +537,8 @@ IntIsWindowDirty(PWINDOW_OBJECT Window)
{
return (Window->Style & WS_VISIBLE) &&
((Window->UpdateRegion != NULL) ||
(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT));
(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) ||
(Window->Flags & WINDOWOBJECT_NEED_NCPAINT));
}
HWND STDCALL
@ -873,6 +874,7 @@ NtUserGetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
return ERROR;
}
IntLockWindowUpdate(Window);
if (Window->UpdateRegion == NULL)
{
RegionType = (NtGdiSetRectRgn(hRgn, 0, 0, 0, 0) ? NULLREGION : ERROR);
@ -885,6 +887,7 @@ NtUserGetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
Window->WindowRect.left - Window->ClientRect.left,
Window->WindowRect.top - Window->ClientRect.top);
}
IntUnLockWindowUpdate(Window);
IntReleaseWindowObject(Window);
@ -904,49 +907,56 @@ NtUserGetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
*/
BOOL STDCALL
NtUserGetUpdateRect(HWND Wnd, LPRECT UnsafeRect, BOOL Erase)
NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
{
PWINDOW_OBJECT Window;
RECT Rect;
HRGN Rgn;
INT RegionType;
PROSRGNDATA RgnData;
BOOL AlwaysPaint;
NTSTATUS Status;
Rgn = NtGdiCreateRectRgn(0, 0, 0, 0);
if (NULL == Rgn)
if (!(Window = IntGetWindowObject(hWnd)))
{
NtGdiDeleteObject(Rgn);
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
return FALSE;
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return ERROR;
}
NtUserGetUpdateRgn(Wnd, Rgn, Erase);
RgnData = RGNDATA_LockRgn(Rgn);
if (NULL == RgnData)
IntLockWindowUpdate(Window);
if (Window->UpdateRegion == NULL)
{
NtGdiDeleteObject(Rgn);
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
return FALSE;
Rect.left = Rect.top = Rect.right = Rect.bottom = 0;
}
if (ERROR == UnsafeIntGetRgnBox(RgnData, &Rect))
else
{
RGNDATA_UnlockRgn(Rgn);
NtGdiDeleteObject(Rgn);
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
return FALSE;
RgnData = RGNDATA_LockRgn(Window->UpdateRegion);
ASSERT(RgnData != NULL);
RegionType = UnsafeIntGetRgnBox(RgnData, &Rect);
ASSERT(RegionType != ERROR);
RGNDATA_UnlockRgn(Window->UpdateRegion);
}
AlwaysPaint = (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) ||
(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT);
IntUnLockWindowUpdate(Window);
IntReleaseWindowObject(Window);
if (bErase && Rect.left < Rect.right && Rect.top < Rect.bottom)
{
NtUserRedrawWindow(hWnd, NULL, NULL, RDW_ERASENOW | RDW_NOCHILDREN);
}
RGNDATA_UnlockRgn(Rgn);
NtGdiDeleteObject(Rgn);
if (UnsafeRect != NULL)
{
Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECT));
if (! NT_SUCCESS(Status))
if (!NT_SUCCESS(Status))
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
return Rect.left < Rect.right && Rect.top < Rect.bottom;
return (Rect.left < Rect.right && Rect.top < Rect.bottom) || AlwaysPaint;
}
/*