Fixes to get CS_PARENTDC working

svn path=/trunk/; revision=4895
This commit is contained in:
Gé van Geldorp 2003-06-15 20:08:02 +00:00
parent 53bf611e09
commit acf78985a1
2 changed files with 29 additions and 22 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.17 2003/05/31 08:51:58 gvg Exp $ /* $Id: painting.c,v 1.18 2003/06/15 20:08:02 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -859,6 +859,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
RECT ClientRect; RECT ClientRect;
RECT ClipRect; RECT ClipRect;
NTSTATUS Status; NTSTATUS Status;
INT DcxFlags;
Status = Status =
ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable, ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
@ -888,30 +889,34 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
/* FIXME: Hide claret. */ /* FIXME: Hide claret. */
DcxFlags = DCX_INTERSECTRGN | DCX_WINDOWPAINT | DCX_USESTYLE;
if (IsIcon)
{
DcxFlags |= DCX_WINDOW;
}
if (NtUserGetClassLong(Window->Self, GCL_STYLE) & CS_PARENTDC) if (NtUserGetClassLong(Window->Self, GCL_STYLE) & CS_PARENTDC)
{ {
if (UpdateRegion != NULL) /* Don't clip the output to the update region for CS_PARENTDC window */
if ((HRGN) 1 < UpdateRegion)
{ {
W32kDeleteObject(UpdateRegion); W32kDeleteObject(UpdateRegion);
} }
lPs->hdc = NtUserGetDCEx(hWnd, 0, DCX_WINDOWPAINT | DCX_USESTYLE | UpdateRegion = NULL;
(IsIcon ? DCX_WINDOW : 0)); DcxFlags &= ~DCX_INTERSECTRGN;
} }
else else
{ {
if (UpdateRegion != NULL) if (NULL == UpdateRegion) /* empty region, clip everything */
{ {
W32kOffsetRgn(UpdateRegion, UpdateRegion = W32kCreateRectRgn(0, 0, 0, 0);
Window->WindowRect.left -
Window->ClientRect.left,
Window->WindowRect.top -
Window->ClientRect.top);
} }
lPs->hdc = NtUserGetDCEx(hWnd, UpdateRegion, DCX_INTERSECTRGN | else if ((HRGN) 1 == UpdateRegion) /* whole client area, don't clip */
DCX_WINDOWPAINT | DCX_USESTYLE | {
(IsIcon ? DCX_WINDOW : 0)); UpdateRegion = NULL;
DcxFlags &= ~DCX_INTERSECTRGN;
} }
}
lPs->hdc = NtUserGetDCEx(hWnd, UpdateRegion, DcxFlags);
/* FIXME: Check for DC creation failure. */ /* FIXME: Check for DC creation failure. */

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.11 2003/05/18 17:16:17 ea Exp $ /* $Id: windc.c,v 1.12 2003/06/15 20:08:02 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -503,13 +503,15 @@ NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags)
Window->Self, Flags); Window->Self, Flags);
if (Flags & DCX_WINDOW) if (Flags & DCX_WINDOW)
{ {
W32kOffsetRgn(hRgnVisible, -Window->WindowRect.left, W32kOffsetRgn(hRgnVisible,
-Window->WindowRect.top); Parent->WindowRect.left - Window->WindowRect.left,
Parent->WindowRect.top - Window->WindowRect.top);
} }
else else
{ {
W32kOffsetRgn(hRgnVisible, -Window->ClientRect.left, W32kOffsetRgn(hRgnVisible,
-Window->ClientRect.top); Parent->ClientRect.left - Window->ClientRect.left,
Parent->ClientRect.top - Window->ClientRect.top);
} }
DceOffsetVisRgn(Dce->hDC, hRgnVisible); DceOffsetVisRgn(Dce->hDC, hRgnVisible);
} }
@ -532,11 +534,11 @@ NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags)
hRgnVisible = DceGetVisRgn(hWnd, Flags, 0, 0); hRgnVisible = DceGetVisRgn(hWnd, Flags, 0, 0);
DceOffsetVisRgn(Dce->hDC, hRgnVisible); DceOffsetVisRgn(Dce->hDC, hRgnVisible);
} }
}
Dce->DCXFlags &= ~DCX_DCEDIRTY; Dce->DCXFlags &= ~DCX_DCEDIRTY;
W32kSelectVisRgn(Dce->hDC, hRgnVisible); W32kSelectVisRgn(Dce->hDC, hRgnVisible);
} }
}
if (Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) if (Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN))
{ {