- Painting bugfixes.

svn path=/trunk/; revision=6702
This commit is contained in:
Filip Navara 2003-11-19 09:10:36 +00:00
parent fa60c511c7
commit 880ff5e0bd
6 changed files with 106 additions and 51 deletions

View file

@ -1,4 +1,4 @@
/* $Id: vis.h,v 1.2 2003/08/02 19:56:19 dwelch Exp $ /* $Id: vis.h,v 1.3 2003/11/19 09:10:35 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Win32k subsystem * PROJECT: ReactOS Win32k subsystem
@ -21,7 +21,7 @@ VIS_ComputeVisibleRegion(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
VOID FASTCALL VOID FASTCALL
VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window, VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
HRGN UncoveredRgn); HRGN UncoveredRgn, BOOL Redraw);
VOID FASTCALL VOID FASTCALL
VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn); VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Id: painting.c,v 1.34 2003/11/18 20:49:39 navaraf Exp $ * $Id: painting.c,v 1.35 2003/11/19 09:10:36 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -123,6 +123,46 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
if (Flags & (RDW_ERASENOW | RDW_UPDATENOW)) if (Flags & (RDW_ERASENOW | RDW_UPDATENOW))
{ {
if (IntIsDesktopWindow(Window))
{
/*
* Repainting of desktop window
*/
#ifndef DESKTOP_IN_CSRSS
VIS_RepaintDesktop(hWnd, Window->UpdateRegion);
#else
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{
MsqDecPaintCountQueue(Window->MessageQueue);
Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
}
if (Window->UpdateRegion ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{
MsqDecPaintCountQueue(Window->MessageQueue);
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
}
if (Window->UpdateRegion)
{
hDC = NtUserGetDCEx(hWnd, 0, DCX_CACHE | DCX_USESTYLE |
DCX_INTERSECTUPDATE);
if (hDC != NULL)
{
NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0);
NtUserReleaseDC(hWnd, hDC);
DeleteObject(WindowObject->UpdateRegion);
WindowObject->UpdateRegion = NULL;
}
}
#endif
}
else
{
/*
* Repainting of non-desktop window
*/
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{ {
NtUserSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window), 0); NtUserSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window), 0);
@ -136,19 +176,8 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
DCX_INTERSECTUPDATE); DCX_INTERSECTUPDATE);
if (hDC != NULL) if (hDC != NULL)
{ {
#ifndef DESKTOP_IN_CSRSS
if (IntIsDesktopWindow(Window))
{
VIS_RepaintDesktop(Window->Self, Window->UpdateRegion);
NtGdiDeleteObject(Window->UpdateRegion);
Window->UpdateRegion = 0;
}
else
#endif
{
if (NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0)) if (NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0))
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND; Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
}
NtUserReleaseDC(hWnd, hDC); NtUserReleaseDC(hWnd, hDC);
} }
} }
@ -159,12 +188,16 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
if (Window->UpdateRegion != NULL || if (Window->UpdateRegion != NULL ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{ {
#ifndef DESKTOP_IN_CSRSS
if (IntIsDesktopWindow(Window))
VIS_RepaintDesktop(Window->Self, Window->UpdateRegion);
else
#endif
NtUserSendMessage(hWnd, WM_PAINT, 0, 0); NtUserSendMessage(hWnd, WM_PAINT, 0, 0);
if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
if (Window->UpdateRegion == NULL)
{
MsqDecPaintCountQueue(Window->MessageQueue);
}
}
}
} }
} }
} }
@ -190,9 +223,12 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
for (phWnd = List; *phWnd; ++phWnd) for (phWnd = List; *phWnd; ++phWnd)
{ {
Window = IntGetWindowObject(*phWnd); Window = IntGetWindowObject(*phWnd);
if (Window)
{
IntPaintWindows(Window, Flags); IntPaintWindows(Window, Flags);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
} }
}
ExFreePool(List); ExFreePool(List);
} }
} }
@ -478,7 +514,7 @@ IntRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRgn,
* Validate parent covered by region. * Validate parent covered by region.
*/ */
if (Window->UpdateRegion != 0 && Flags & RDW_UPDATENOW) if (Window->UpdateRegion != NULL && Flags & RDW_UPDATENOW)
{ {
IntValidateParent(Window); IntValidateParent(Window);
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Id: vis.c,v 1.8 2003/11/18 20:49:39 navaraf Exp $ * $Id: vis.c,v 1.9 2003/11/19 09:10:36 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -251,7 +251,7 @@ GetUncoveredArea(HRGN Uncovered, PWINDOW_OBJECT Parent, PWINDOW_OBJECT TargetChi
VOID FASTCALL VOID FASTCALL
VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window, VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
HRGN NewlyExposed) HRGN NewlyExposed, BOOL Redraw)
{ {
PWINDOW_OBJECT DesktopWindow; PWINDOW_OBJECT DesktopWindow;
PWINDOW_OBJECT Parent; PWINDOW_OBJECT Parent;
@ -303,8 +303,9 @@ VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
{ {
NtGdiOffsetRgn(DirtyRgn, -Sibling->ClientRect.left, -Sibling->ClientRect.top); NtGdiOffsetRgn(DirtyRgn, -Sibling->ClientRect.left, -Sibling->ClientRect.top);
IntRedrawWindow(Sibling, NULL, DirtyRgn, IntRedrawWindow(Sibling, NULL, DirtyRgn,
RDW_INVALIDATE | RDW_FRAME | RDW_ERASE RDW_INVALIDATE | RDW_FRAME | RDW_ERASE |
| RDW_ALLCHILDREN); RDW_ALLCHILDREN |
(Redraw ? RDW_ERASENOW | RDW_UPDATENOW : 0));
} }
Covered = UnsafeIntCreateRectRgnIndirect(&Sibling->WindowRect); Covered = UnsafeIntCreateRectRgnIndirect(&Sibling->WindowRect);
NtGdiCombineRgn(Uncovered, Uncovered, Covered, RGN_DIFF); NtGdiCombineRgn(Uncovered, Uncovered, Covered, RGN_DIFF);
@ -331,8 +332,9 @@ VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
NtGdiOffsetRgn(DirtyRgn, -Parent->ClientRect.left, NtGdiOffsetRgn(DirtyRgn, -Parent->ClientRect.left,
-Parent->ClientRect.top); -Parent->ClientRect.top);
IntRedrawWindow(Parent, NULL, DirtyRgn, IntRedrawWindow(Parent, NULL, DirtyRgn,
RDW_INVALIDATE | RDW_FRAME | RDW_ERASE RDW_INVALIDATE | RDW_FRAME | RDW_ERASE |
| RDW_NOCHILDREN); RDW_NOCHILDREN |
(Redraw ? RDW_ERASENOW | RDW_UPDATENOW : 0));
} }
NtGdiDeleteObject(ExposedWindow); NtGdiDeleteObject(ExposedWindow);
NtGdiDeleteObject(DirtyRgn); NtGdiDeleteObject(DirtyRgn);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: windc.c,v 1.35 2003/11/18 20:49:39 navaraf Exp $ /* $Id: windc.c,v 1.36 2003/11/19 09:10:36 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -436,13 +436,24 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
if (0 != (Flags & DCX_INTERSECTUPDATE) && NULL == ClipRegion) if (0 != (Flags & DCX_INTERSECTUPDATE) && NULL == ClipRegion)
{ {
Dce->hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); Dce->hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
if (Dce->hClipRgn) if (Dce->hClipRgn && Window->UpdateRegion)
{ {
if (Window->UpdateRegion)
NtGdiCombineRgn(Dce->hClipRgn, Window->UpdateRegion, NULL, RGN_COPY); NtGdiCombineRgn(Dce->hClipRgn, Window->UpdateRegion, NULL, RGN_COPY);
NtGdiOffsetRgn(Dce->hClipRgn, NtGdiOffsetRgn(Dce->hClipRgn,
Window->WindowRect.left - Window->ClientRect.left, Window->WindowRect.left - Window->ClientRect.left,
Window->WindowRect.top - Window->ClientRect.top); Window->WindowRect.top - Window->ClientRect.top);
/*
if (!(Flags & DCX_WINDOW))
{
HRGN ClientRgn = NtGdiCreateRectRgnIndirect(&Window->ClientRect);
NtGdiOffsetRgn(ClientRgn,
-Window->ClientRect.left,
-Window->ClientRect.top);
NtGdiCombineRgn(Dce->hClipRgn, Dce->hClipRgn, ClientRgn, RGN_AND);
NtGdiDeleteObject(ClientRgn);
}
*/
} }
Flags &= DCX_INTERSECTRGN; Flags &= DCX_INTERSECTRGN;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: window.c,v 1.136 2003/11/18 20:49:39 navaraf Exp $ /* $Id: window.c,v 1.137 2003/11/19 09:10:36 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -675,7 +675,7 @@ IntInitDesktopWindow(ULONG Width, ULONG Height)
DesktopWindow->ClientRect = DesktopWindow->WindowRect; DesktopWindow->ClientRect = DesktopWindow->WindowRect;
DesktopRgn = UnsafeIntCreateRectRgnIndirect(&(DesktopWindow->WindowRect)); DesktopRgn = UnsafeIntCreateRectRgnIndirect(&(DesktopWindow->WindowRect));
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, DesktopWindow, DesktopRgn); VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, DesktopWindow, DesktopRgn, TRUE);
NtGdiDeleteObject(DesktopRgn); NtGdiDeleteObject(DesktopRgn);
IntReleaseWindowObject(DesktopWindow); IntReleaseWindowObject(DesktopWindow);
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: winpos.c,v 1.41 2003/11/18 20:49:39 navaraf Exp $ /* $Id: winpos.c,v 1.42 2003/11/19 09:10:36 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -922,9 +922,13 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
RgnType = NtGdiCombineRgn(DirtyRgn, VisAfter, CopyRgn, RGN_DIFF); RgnType = NtGdiCombineRgn(DirtyRgn, VisAfter, CopyRgn, RGN_DIFF);
if (ERROR != RgnType && NULLREGION != RgnType) if (ERROR != RgnType && NULLREGION != RgnType)
{ {
NtGdiOffsetRgn(DirtyRgn,
Window->WindowRect.left - Window->ClientRect.left,
Window->WindowRect.top - Window->ClientRect.top);
IntRedrawWindow(Window, NULL, DirtyRgn, IntRedrawWindow(Window, NULL, DirtyRgn,
RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_INVALIDATE |
RDW_ALLCHILDREN | RDW_ERASENOW); RDW_ALLCHILDREN |
((flags & SWP_NOREDRAW) ? 0 : RDW_ERASENOW | RDW_UPDATENOW));
} }
NtGdiDeleteObject(DirtyRgn); NtGdiDeleteObject(DirtyRgn);
} }
@ -932,7 +936,8 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
{ {
IntRedrawWindow(Window, NULL, NULL, IntRedrawWindow(Window, NULL, NULL,
RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_INVALIDATE |
RDW_ALLCHILDREN | RDW_ERASENOW); RDW_ALLCHILDREN |
((flags & SWP_NOREDRAW) ? 0 : RDW_ERASENOW | RDW_UPDATENOW));
} }
} }
@ -959,7 +964,8 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
} }
if (ERROR != RgnType && NULLREGION != RgnType) if (ERROR != RgnType && NULLREGION != RgnType)
{ {
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, Window, ExposedRgn); VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, Window,
ExposedRgn, !(flags & SWP_NOREDRAW));
} }
NtGdiDeleteObject(ExposedRgn); NtGdiDeleteObject(ExposedRgn);