- Fixed multiwin.exe painting problem.

- Reverted my fix to cursoricon.c.

svn path=/trunk/; revision=6741
This commit is contained in:
Filip Navara 2003-11-21 21:12:09 +00:00
parent 824b2303c4
commit ba0efcb546
4 changed files with 89 additions and 56 deletions

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.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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -169,6 +169,10 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
#ifndef DESKTOP_IN_CSRSS #ifndef DESKTOP_IN_CSRSS
VIS_RepaintDesktop(hWnd, Window->UpdateRegion); VIS_RepaintDesktop(hWnd, Window->UpdateRegion);
Window->Flags &= ~(WINDOWOBJECT_NEED_NCPAINT |
WINDOWOBJECT_NEED_INTERNALPAINT | WINDOWOBJECT_NEED_ERASEBKGND);
NtGdiDeleteObject(Window->UpdateRegion);
Window->UpdateRegion = NULL;
#else #else
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{ {
@ -189,8 +193,8 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
{ {
NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0); NtUserSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0);
NtUserReleaseDC(hWnd, hDC); NtUserReleaseDC(hWnd, hDC);
DeleteObject(WindowObject->UpdateRegion); NtGdiDeleteObject(Window->UpdateRegion);
WindowObject->UpdateRegion = NULL; Window->UpdateRegion = NULL;
} }
} }
#endif #endif
@ -279,11 +283,13 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
*/ */
VOID FASTCALL VOID FASTCALL
IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags) IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags,
BOOL ValidateParent)
{ {
INT RgnType; INT RgnType;
BOOL HadPaintMessage, HadNCPaintMessage; BOOL HadPaintMessage, HadNCPaintMessage;
BOOL HasPaintMessage, HasNCPaintMessage; BOOL HasPaintMessage, HasNCPaintMessage;
HRGN hRgnWindow;
/* /*
* Clip the given region with window rectangle (or region) * Clip the given region with window rectangle (or region)
@ -293,7 +299,6 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
if (!Window->WindowRegion) if (!Window->WindowRegion)
#endif #endif
{ {
HRGN hRgnWindow;
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect);
NtGdiOffsetRgn(hRgnWindow, NtGdiOffsetRgn(hRgnWindow,
-Window->WindowRect.left, -Window->WindowRect.left,
@ -372,6 +377,68 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT; Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
} }
/*
* Validate parent covered by region
*/
if (ValidateParent)
{
IntValidateParent(Window);
}
/*
* Process children if needed
*/
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)))
{
HWND *List, *phWnd;
PWINDOW_OBJECT Child;
if ((List = IntWinListChildren(Window)))
{
for (phWnd = List; *phWnd; ++phWnd)
{
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);
NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY);
NtGdiOffsetRgn(hRgnTemp,
Window->WindowRect.left - Child->WindowRect.left,
Window->WindowRect.top - Child->WindowRect.top);
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 * Fake post paint messages to window message queue if needed
*/ */
@ -402,38 +469,6 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
#ifndef DESKTOP_IN_CSRSS #ifndef DESKTOP_IN_CSRSS
} }
#endif #endif
/*
* Process children if needed
*/
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)))
{
HWND *List, *phWnd;
PWINDOW_OBJECT Child;
if ((List = IntWinListChildren(Window)))
{
for (phWnd = List; *phWnd; ++phWnd)
{
Child = IntGetWindowObject(*phWnd);
if ((Child->Style & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE)
{
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);
NtGdiDeleteObject(hRgnTemp);
}
IntReleaseWindowObject(Child);
}
ExFreePool(List);
}
}
} }
/* /*
@ -528,15 +563,11 @@ IntRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRgn,
if (Flags & (RDW_INVALIDATE | RDW_VALIDATE | RDW_INTERNALPAINT | RDW_NOINTERNALPAINT)) if (Flags & (RDW_INVALIDATE | RDW_VALIDATE | RDW_INTERNALPAINT | RDW_NOINTERNALPAINT))
{ {
IntInvalidateWindows(Window, hRgn, Flags); IntInvalidateWindows(Window, hRgn, Flags, TRUE);
} } else
if (Window->UpdateRegion != NULL && Flags & RDW_ERASENOW)
/*
* Validate parent covered by region.
*/
if (Window->UpdateRegion != NULL && Flags & (RDW_ERASENOW | RDW_VALIDATE))
{ {
/* Validate parent covered by region. */
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.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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -215,9 +215,12 @@ VOID FASTCALL
VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn) VIS_RepaintDesktop(HWND Desktop, HRGN RepaintRgn)
{ {
HDC dc = NtUserGetDC(Desktop); HDC dc = NtUserGetDC(Desktop);
if (dc)
{
HBRUSH DesktopBrush = NtGdiCreateSolidBrush(RGB(58, 110, 165)); HBRUSH DesktopBrush = NtGdiCreateSolidBrush(RGB(58, 110, 165));
NtGdiFillRgn(dc, RepaintRgn, DesktopBrush); NtGdiFillRgn(dc, RepaintRgn, DesktopBrush);
NtGdiDeleteObject(DesktopBrush); NtGdiDeleteObject(DesktopBrush);
}
NtUserReleaseDC(Desktop, dc); NtUserReleaseDC(Desktop, dc);
} }

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.141 2003/11/21 17:01:16 navaraf Exp $ /* $Id: window.c,v 1.142 2003/11/21 21:12:08 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -666,6 +666,8 @@ IntInitDesktopWindow(ULONG Width, ULONG Height)
{ {
return; return;
} }
DesktopWindow->WindowRect.left = 0;
DesktopWindow->WindowRect.top = 0;
DesktopWindow->WindowRect.right = Width; DesktopWindow->WindowRect.right = Width;
DesktopWindow->WindowRect.bottom = Height; DesktopWindow->WindowRect.bottom = Height;
DesktopWindow->ClientRect = DesktopWindow->WindowRect; DesktopWindow->ClientRect = DesktopWindow->WindowRect;

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: cursoricon.c,v 1.22 2003/11/21 16:36:26 weiden Exp $ */ /* $Id: cursoricon.c,v 1.23 2003/11/21 21:12:09 navaraf Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
@ -82,7 +82,6 @@ IntSendSetCursorMessage(PWINDOW_OBJECT Window, USHORT Msg, USHORT HitTest)
HCURSOR FASTCALL HCURSOR FASTCALL
IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange) IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange)
{ {
HDC hDC;
PDC dc; PDC dc;
PSURFOBJ SurfObj; PSURFOBJ SurfObj;
PSURFGDI SurfGDI; PSURFGDI SurfGDI;
@ -106,13 +105,11 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL Fo
goto done; goto done;
/* FIXME use the desktop's HDC instead of using ScreenDeviceContext */ /* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
hDC = NtUserGetDC(0); dc = DC_LockDc(ScreenDeviceContext);
dc = DC_LockDc(hDC);
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface); SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface);
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface); SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) dc->Surface);
DevInfo = dc->DevInfo; DevInfo = dc->DevInfo;
DC_UnlockDc(hDC); DC_UnlockDc(ScreenDeviceContext);
NtUserReleaseDC(0, hDC);
if(!NewCursor && (CurInfo->CurrentCursorObject || ForceChange)) if(!NewCursor && (CurInfo->CurrentCursorObject || ForceChange))
{ {