- 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
* PROJECT: ReactOS Win32k subsystem
@ -21,7 +21,7 @@ VIS_ComputeVisibleRegion(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
VOID FASTCALL
VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
HRGN UncoveredRgn);
HRGN UncoveredRgn, BOOL Redraw);
VOID FASTCALL
VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn);

View file

@ -16,7 +16,7 @@
* 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.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
* PROJECT: ReactOS kernel
@ -123,48 +123,81 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
if (Flags & (RDW_ERASENOW | RDW_UPDATENOW))
{
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
if (IntIsDesktopWindow(Window))
{
NtUserSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window), 0);
}
/*
* Repainting of desktop window
*/
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
{
#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)
{
#ifndef DESKTOP_IN_CSRSS
if (IntIsDesktopWindow(Window))
{
VIS_RepaintDesktop(Window->Self, Window->UpdateRegion);
NtGdiDeleteObject(Window->UpdateRegion);
Window->UpdateRegion = 0;
}
else
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)
{
NtUserSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window), 0);
}
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
{
if (Window->UpdateRegion)
{
hDC = NtUserGetDCEx(hWnd, 0, DCX_CACHE | DCX_USESTYLE |
DCX_INTERSECTUPDATE);
if (hDC != NULL)
{
if (NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0))
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
NtUserReleaseDC(hWnd, hDC);
}
NtUserReleaseDC(hWnd, hDC);
}
}
}
if (Flags & RDW_UPDATENOW)
{
if (Window->UpdateRegion != NULL ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
if (Flags & RDW_UPDATENOW)
{
#ifndef DESKTOP_IN_CSRSS
if (IntIsDesktopWindow(Window))
VIS_RepaintDesktop(Window->Self, Window->UpdateRegion);
else
#endif
if (Window->UpdateRegion != NULL ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{
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,8 +223,11 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
for (phWnd = List; *phWnd; ++phWnd)
{
Window = IntGetWindowObject(*phWnd);
IntPaintWindows(Window, Flags);
IntReleaseWindowObject(Window);
if (Window)
{
IntPaintWindows(Window, Flags);
IntReleaseWindowObject(Window);
}
}
ExFreePool(List);
}
@ -478,7 +514,7 @@ IntRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRgn,
* Validate parent covered by region.
*/
if (Window->UpdateRegion != 0 && Flags & RDW_UPDATENOW)
if (Window->UpdateRegion != NULL && Flags & RDW_UPDATENOW)
{
IntValidateParent(Window);
}

View file

@ -16,7 +16,7 @@
* 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.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
* PROJECT: ReactOS kernel
@ -251,7 +251,7 @@ GetUncoveredArea(HRGN Uncovered, PWINDOW_OBJECT Parent, PWINDOW_OBJECT TargetChi
VOID FASTCALL
VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
HRGN NewlyExposed)
HRGN NewlyExposed, BOOL Redraw)
{
PWINDOW_OBJECT DesktopWindow;
PWINDOW_OBJECT Parent;
@ -303,8 +303,9 @@ VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
{
NtGdiOffsetRgn(DirtyRgn, -Sibling->ClientRect.left, -Sibling->ClientRect.top);
IntRedrawWindow(Sibling, NULL, DirtyRgn,
RDW_INVALIDATE | RDW_FRAME | RDW_ERASE
| RDW_ALLCHILDREN);
RDW_INVALIDATE | RDW_FRAME | RDW_ERASE |
RDW_ALLCHILDREN |
(Redraw ? RDW_ERASENOW | RDW_UPDATENOW : 0));
}
Covered = UnsafeIntCreateRectRgnIndirect(&Sibling->WindowRect);
NtGdiCombineRgn(Uncovered, Uncovered, Covered, RGN_DIFF);
@ -331,8 +332,9 @@ VIS_WindowLayoutChanged(PDESKTOP_OBJECT Desktop, PWINDOW_OBJECT Window,
NtGdiOffsetRgn(DirtyRgn, -Parent->ClientRect.left,
-Parent->ClientRect.top);
IntRedrawWindow(Parent, NULL, DirtyRgn,
RDW_INVALIDATE | RDW_FRAME | RDW_ERASE
| RDW_NOCHILDREN);
RDW_INVALIDATE | RDW_FRAME | RDW_ERASE |
RDW_NOCHILDREN |
(Redraw ? RDW_ERASENOW | RDW_UPDATENOW : 0));
}
NtGdiDeleteObject(ExposedWindow);
NtGdiDeleteObject(DirtyRgn);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS kernel
@ -118,7 +118,7 @@ DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags)
HDC STDCALL
NtUserGetDC(HWND hWnd)
{
return NtUserGetDCEx(hWnd, NULL, NULL == hWnd ? DCX_CACHE | DCX_WINDOW : DCX_USESTYLE);
return NtUserGetDCEx(hWnd, NULL, NULL == hWnd ? DCX_CACHE | DCX_WINDOW : DCX_USESTYLE);
}
PDCE FASTCALL
@ -436,14 +436,25 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
if (0 != (Flags & DCX_INTERSECTUPDATE) && NULL == ClipRegion)
{
Dce->hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
if (Dce->hClipRgn)
{
if (Window->UpdateRegion)
if (Dce->hClipRgn && Window->UpdateRegion)
{
NtGdiCombineRgn(Dce->hClipRgn, Window->UpdateRegion, NULL, RGN_COPY);
NtGdiOffsetRgn(Dce->hClipRgn,
Window->WindowRect.left - Window->ClientRect.left,
Window->WindowRect.top - Window->ClientRect.top);
}
NtGdiOffsetRgn(Dce->hClipRgn,
Window->WindowRect.left - Window->ClientRect.left,
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;
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS kernel
@ -675,7 +675,7 @@ IntInitDesktopWindow(ULONG Width, ULONG Height)
DesktopWindow->ClientRect = DesktopWindow->WindowRect;
DesktopRgn = UnsafeIntCreateRectRgnIndirect(&(DesktopWindow->WindowRect));
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, DesktopWindow, DesktopRgn);
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, DesktopWindow, DesktopRgn, TRUE);
NtGdiDeleteObject(DesktopRgn);
IntReleaseWindowObject(DesktopWindow);
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* 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);
if (ERROR != RgnType && NULLREGION != RgnType)
{
NtGdiOffsetRgn(DirtyRgn,
Window->WindowRect.left - Window->ClientRect.left,
Window->WindowRect.top - Window->ClientRect.top);
IntRedrawWindow(Window, NULL, DirtyRgn,
RDW_ERASE | RDW_FRAME | RDW_INVALIDATE |
RDW_ALLCHILDREN | RDW_ERASENOW);
RDW_ALLCHILDREN |
((flags & SWP_NOREDRAW) ? 0 : RDW_ERASENOW | RDW_UPDATENOW));
}
NtGdiDeleteObject(DirtyRgn);
}
@ -932,7 +936,8 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
{
IntRedrawWindow(Window, NULL, NULL,
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)
{
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, Window, ExposedRgn);
VIS_WindowLayoutChanged(PsGetWin32Thread()->Desktop, Window,
ExposedRgn, !(flags & SWP_NOREDRAW));
}
NtGdiDeleteObject(ExposedRgn);