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