* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: painting.c,v 1.37 2003/11/21 17:01:16 navaraf Exp $
+ * $Id: painting.c,v 1.38 2003/11/21 21:12:08 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
#ifndef DESKTOP_IN_CSRSS
VIS_RepaintDesktop(hWnd, Window->UpdateRegion);
+ Window->Flags &= ~(WINDOWOBJECT_NEED_NCPAINT |
+ WINDOWOBJECT_NEED_INTERNALPAINT | WINDOWOBJECT_NEED_ERASEBKGND);
+ NtGdiDeleteObject(Window->UpdateRegion);
+ Window->UpdateRegion = NULL;
#else
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{
{
NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0);
NtUserReleaseDC(hWnd, hDC);
- DeleteObject(WindowObject->UpdateRegion);
- WindowObject->UpdateRegion = NULL;
+ NtGdiDeleteObject(Window->UpdateRegion);
+ Window->UpdateRegion = NULL;
}
}
#endif
*/
VOID FASTCALL
-IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
+IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags,
+ BOOL ValidateParent)
{
INT RgnType;
BOOL HadPaintMessage, HadNCPaintMessage;
BOOL HasPaintMessage, HasNCPaintMessage;
+ HRGN hRgnWindow;
/*
* Clip the given region with window rectangle (or region)
if (!Window->WindowRegion)
#endif
{
- HRGN hRgnWindow;
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect);
NtGdiOffsetRgn(hRgnWindow,
-Window->WindowRect.left,
}
/*
- * Fake post paint messages to window message queue if needed
+ * Validate parent covered by region
*/
-#ifndef DESKTOP_IN_CSRSS
- if (Window->MessageQueue)
-#endif
+ if (ValidateParent)
{
- HasPaintMessage = Window->UpdateRegion != NULL ||
- Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
- HasNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
-
- if (HasPaintMessage != HadPaintMessage)
- {
- if (HadPaintMessage)
- MsqDecPaintCountQueue(Window->MessageQueue);
- else
- MsqIncPaintCountQueue(Window->MessageQueue);
- }
-
- if (HasNCPaintMessage != HadNCPaintMessage)
- {
- if (HadNCPaintMessage)
- MsqDecPaintCountQueue(Window->MessageQueue);
- else
- MsqIncPaintCountQueue(Window->MessageQueue);
- }
-#ifndef DESKTOP_IN_CSRSS
+ IntValidateParent(Window);
}
-#endif
/*
* Process children if needed
Child = IntGetWindowObject(*phWnd);
if ((Child->Style & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE)
{
+ /*
+ * Recursive call to update children UpdateRegion
+ */
HRGN hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
- Child = IntGetWindowObject(*phWnd);
NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY);
NtGdiOffsetRgn(hRgnTemp,
Window->WindowRect.left - Child->WindowRect.left,
Window->WindowRect.top - Child->WindowRect.top);
- IntInvalidateWindows(Child, hRgnTemp, Flags);
+ IntInvalidateWindows(Child, hRgnTemp, Flags, FALSE);
+
+ /*
+ * Update our UpdateRegion depending on children
+ */
+ NtGdiCombineRgn(hRgnTemp, Child->UpdateRegion, 0, RGN_COPY);
+ NtGdiOffsetRgn(hRgnTemp,
+ Child->WindowRect.left - Window->WindowRect.left,
+ Child->WindowRect.top - Window->WindowRect.top);
+ hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect);
+ NtGdiOffsetRgn(hRgnWindow,
+ -Window->WindowRect.left,
+ -Window->WindowRect.top);
+ NtGdiCombineRgn(hRgnTemp, hRgnTemp, hRgnWindow, RGN_AND);
+ if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
+ hRgnTemp, RGN_DIFF) == NULLREGION)
+ {
+ NtGdiDeleteObject(Window->UpdateRegion);
+ Window->UpdateRegion = NULL;
+ }
NtGdiDeleteObject(hRgnTemp);
}
IntReleaseWindowObject(Child);
ExFreePool(List);
}
}
+
+ /*
+ * Fake post paint messages to window message queue if needed
+ */
+
+#ifndef DESKTOP_IN_CSRSS
+ if (Window->MessageQueue)
+#endif
+ {
+ HasPaintMessage = Window->UpdateRegion != NULL ||
+ Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
+ HasNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
+
+ if (HasPaintMessage != HadPaintMessage)
+ {
+ if (HadPaintMessage)
+ MsqDecPaintCountQueue(Window->MessageQueue);
+ else
+ MsqIncPaintCountQueue(Window->MessageQueue);
+ }
+
+ if (HasNCPaintMessage != HadNCPaintMessage)
+ {
+ if (HadNCPaintMessage)
+ MsqDecPaintCountQueue(Window->MessageQueue);
+ else
+ MsqIncPaintCountQueue(Window->MessageQueue);
+ }
+#ifndef DESKTOP_IN_CSRSS
+ }
+#endif
}
/*
if (Flags & (RDW_INVALIDATE | RDW_VALIDATE | RDW_INTERNALPAINT | RDW_NOINTERNALPAINT))
{
- IntInvalidateWindows(Window, hRgn, Flags);
- }
-
- /*
- * Validate parent covered by region.
- */
-
- if (Window->UpdateRegion != NULL && Flags & (RDW_ERASENOW | RDW_VALIDATE))
+ IntInvalidateWindows(Window, hRgn, Flags, TRUE);
+ } else
+ if (Window->UpdateRegion != NULL && Flags & RDW_ERASENOW)
{
+ /* Validate parent covered by region. */
IntValidateParent(Window);
}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: vis.c,v 1.11 2003/11/21 17:01:16 navaraf Exp $
+ * $Id: vis.c,v 1.12 2003/11/21 21:12:08 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn)
{
HDC dc = NtUserGetDC(Desktop);
- HBRUSH DesktopBrush = NtGdiCreateSolidBrush(RGB(58, 110, 165));
- NtGdiFillRgn(dc, RepaintRgn, DesktopBrush);
- NtGdiDeleteObject(DesktopBrush);
+ if (dc)
+ {
+ HBRUSH DesktopBrush = NtGdiCreateSolidBrush(RGB(58, 110, 165));
+ NtGdiFillRgn(dc, RepaintRgn, DesktopBrush);
+ NtGdiDeleteObject(DesktopBrush);
+ }
NtUserReleaseDC(Desktop, dc);
}