/* INCLUDES ******************************************************************/
-#include <w32k.h>
+#include <win32k.h>
#define NDEBUG
#include <debug.h>
UNICODE_STRING DriverName;
RtlInitUnicodeString(&DriverName, L"DISPLAY");
hDC = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE);
+
+ co_IntGraphicsCheck(TRUE);
+
//
// If NULL, first time through! Build the default window dc!
//
static
HRGN FASTCALL
-DceGetVisRgn(PWINDOW_OBJECT Window, ULONG Flags, HWND hWndChild, ULONG CFlags)
+DceGetVisRgn(PWND Window, ULONG Flags, HWND hWndChild, ULONG CFlags)
{
HRGN VisRgn;
}
PDCE FASTCALL
-DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type)
+DceAllocDCE(PWND Window OPTIONAL, DCE_TYPE Type)
{
PDCE pDce;
- PWND Wnd = NULL;
-
- if (Window) Wnd = Window->Wnd;
pDce = ExAllocatePoolWithTag(PagedPool, sizeof(DCE), TAG_PDCE);
if(!pDce)
}
DCECount++;
DPRINT("Alloc DCE's! %d\n",DCECount);
- pDce->hwndCurrent = (Window ? Window->hSelf : NULL);
- pDce->pwndOrg = Wnd;
- pDce->pwndClip = Wnd;
+ pDce->hwndCurrent = (Window ? Window->head.h : NULL);
+ pDce->pwndOrg = Window;
+ pDce->pwndClip = Window;
pDce->hrgnClip = NULL;
pDce->hrgnClipPublic = NULL;
pDce->hrgnSavedVis = NULL;
else
{
pDce->DCXFlags = DCX_DCEBUSY;
- if (Wnd)
+ if (Window)
{
if (Type == DCE_WINDOW_DC)
{
- if (Wnd->style & WS_CLIPCHILDREN) pDce->DCXFlags |= DCX_CLIPCHILDREN;
- if (Wnd->style & WS_CLIPSIBLINGS) pDce->DCXFlags |= DCX_CLIPSIBLINGS;
+ if (Window->style & WS_CLIPCHILDREN) pDce->DCXFlags |= DCX_CLIPCHILDREN;
+ if (Window->style & WS_CLIPSIBLINGS) pDce->DCXFlags |= DCX_CLIPSIBLINGS;
}
}
}
}
static VOID APIENTRY
-DceSetDrawable( PWINDOW_OBJECT Window OPTIONAL,
+DceSetDrawable( PWND Window OPTIONAL,
HDC hDC,
ULONG Flags,
BOOL SetClipOrigin)
{
- PWND Wnd;
DC *dc = DC_LockDc(hDC);
if(!dc)
return;
}
else
{
- Wnd = Window->Wnd;
if (Flags & DCX_WINDOW)
{
- dc->ptlDCOrig.x = Wnd->rcWindow.left;
- dc->ptlDCOrig.y = Wnd->rcWindow.top;
+ dc->ptlDCOrig.x = Window->rcWindow.left;
+ dc->ptlDCOrig.y = Window->rcWindow.top;
}
else
{
- dc->ptlDCOrig.x = Wnd->rcClient.left;
- dc->ptlDCOrig.y = Wnd->rcClient.top;
+ dc->ptlDCOrig.x = Window->rcClient.left;
+ dc->ptlDCOrig.y = Window->rcClient.top;
}
}
DC_UnlockDc(dc);
}
static VOID FASTCALL
-DceUpdateVisRgn(DCE *Dce, PWINDOW_OBJECT Window, ULONG Flags)
+DceUpdateVisRgn(DCE *Dce, PWND Window, ULONG Flags)
{
HANDLE hRgnVisible = NULL;
ULONG DcxFlags;
- PWINDOW_OBJECT DesktopWindow;
+ PWND DesktopWindow;
if (Flags & DCX_PARENTCLIP)
{
- PWINDOW_OBJECT Parent;
- PWND ParentWnd;
+ PWND Parent;
Parent = Window->spwndParent;
if(!Parent)
goto noparent;
}
- ParentWnd = Parent->Wnd;
-
- if (ParentWnd->style & WS_CLIPSIBLINGS)
+ if (Parent->style & WS_CLIPSIBLINGS)
{
DcxFlags = DCX_CLIPSIBLINGS |
(Flags & ~(DCX_CLIPCHILDREN | DCX_WINDOW));
{
DcxFlags = Flags & ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_WINDOW);
}
- hRgnVisible = DceGetVisRgn(Parent, DcxFlags, Window->hSelf, Flags);
+ hRgnVisible = DceGetVisRgn(Parent, DcxFlags, Window->head.h, Flags);
}
else if (Window == NULL)
{
DesktopWindow = UserGetWindowObject(IntGetDesktopWindow());
if (NULL != DesktopWindow)
{
- hRgnVisible = IntSysCreateRectRgnIndirect(&DesktopWindow->Wnd->rcWindow);
+ hRgnVisible = IntSysCreateRectRgnIndirect(&DesktopWindow->rcWindow);
}
else
{
}
HDC FASTCALL
-UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
+UserGetDCEx(PWND Wnd OPTIONAL, HANDLE ClipRegion, ULONG Flags)
{
- PWINDOW_OBJECT Parent;
+ PWND Parent;
ULONG DcxFlags;
DCE* Dce = NULL;
BOOL UpdateClipOrigin = FALSE;
- PWND Wnd = NULL;
HDC hDC = NULL;
PPROCESSINFO ppi;
PLIST_ENTRY pLE;
- if (NULL == Window)
+ if (NULL == Wnd)
{
Flags &= ~DCX_USESTYLE;
Flags |= DCX_CACHE;
}
- else
- Wnd = Window->Wnd;
if (Flags & (DCX_WINDOW | DCX_PARENTCLIP)) Flags |= DCX_CACHE;
Flags &= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN);
}
- Parent = (Window ? Window->spwndParent : NULL);
+ Parent = (Wnd ? Wnd->spwndParent : NULL);
- if (NULL == Window || !(Wnd->style & WS_CHILD) || NULL == Parent)
+ if (NULL == Wnd || !(Wnd->style & WS_CHILD) || NULL == Parent)
{
Flags &= ~DCX_PARENTCLIP;
Flags |= DCX_CLIPSIBLINGS;
if (Flags & DCX_PARENTCLIP)
{
if ((Wnd->style & WS_VISIBLE) &&
- (Parent->Wnd->style & WS_VISIBLE))
+ (Parent->style & WS_VISIBLE))
{
Flags &= ~DCX_CLIPCHILDREN;
- if (Parent->Wnd->style & WS_CLIPSIBLINGS)
+ if (Parent->style & WS_CLIPSIBLINGS)
{
Flags |= DCX_CLIPSIBLINGS;
}
{
DceEmpty = Dce;
}
- else if (Dce->hwndCurrent == (Window ? Window->hSelf : NULL) &&
+ else if (Dce->hwndCurrent == (Wnd ? Wnd->head.h : NULL) &&
((Dce->DCXFlags & DCX_CACHECOMPAREMASK) == DcxFlags))
{
UpdateClipOrigin = TRUE;
}
if (!Dce) return NULL;
- Dce->hwndCurrent = (Window ? Window->hSelf : NULL);
+ Dce->hwndCurrent = (Wnd ? Wnd->head.h : NULL);
}
else // If we are here, we are POWNED or having CLASS.
{
Dce = CONTAINING_RECORD(pLE, DCE, List);
do
{ // Check for Window handle than HDC match for CLASS.
- if ((Dce->hwndCurrent == Window->hSelf) ||
+ if ((Dce->hwndCurrent == Wnd->head.h) ||
(Dce->hDC == hDC))
break;
pLE = Dce->List.Flink;
{
Flags |= DCX_INTERSECTRGN | DCX_KEEPCLIPRGN;
Dce->DCXFlags |= DCX_INTERSECTRGN | DCX_KEEPCLIPRGN;
- ClipRegion = Window->hrgnUpdate;
+ ClipRegion = Wnd->hrgnUpdate;
}
if (ClipRegion == (HRGN) 1)
{
if (!(Flags & DCX_WINDOW))
{
- Dce->hrgnClip = IntSysCreateRectRgnIndirect(&Window->Wnd->rcClient);
+ Dce->hrgnClip = IntSysCreateRectRgnIndirect(&Wnd->rcClient);
}
else
{
- Dce->hrgnClip = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow);
+ Dce->hrgnClip = IntSysCreateRectRgnIndirect(&Wnd->rcWindow);
}
Dce->DCXFlags &= ~DCX_KEEPCLIPRGN;
}
Dce->hrgnClip = ClipRegion;
}
- DceSetDrawable(Window, Dce->hDC, Flags, UpdateClipOrigin);
+ DceSetDrawable(Wnd, Dce->hDC, Flags, UpdateClipOrigin);
- DceUpdateVisRgn(Dce, Window, Flags);
+ DceUpdateVisRgn(Dce, Wnd, Flags);
if (Dce->DCXFlags & DCX_CACHE)
{
Hit = TRUE;
}
}
+ else
+ {
+ if (!GreGetObjectOwner(pdce->hDC, GDIObjType_DC_TYPE))
+ DC_SetOwnership( pdce->hDC, PsGetCurrentProcess());
+ }
if (!Hit) IntGdiDeleteDC(pdce->hDC, TRUE);
* Remove owned DCE and reset unreleased cache DCEs.
*/
void FASTCALL
-DceFreeWindowDCE(PWINDOW_OBJECT Window)
+DceFreeWindowDCE(PWND Window)
{
PDCE pDCE;
PLIST_ENTRY pLE;
DPRINT1("FreeWindowDCE List is Empty!!!!\n");
break;
}
- if ( pDCE->hwndCurrent == Window->hSelf &&
+ if ( pDCE->hwndCurrent == Window->head.h &&
!(pDCE->DCXFlags & DCX_DCEEMPTY) )
{
if (!(pDCE->DCXFlags & DCX_CACHE)) /* owned or Class DCE*/
{
- if (Window->Wnd->pcls->style & CS_CLASSDC) /* Test Class first */
+ if (Window->pcls->style & CS_CLASSDC) /* Test Class first */
{
if (pDCE->DCXFlags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) /* Class DCE*/
DceDeleteClipRgn(pDCE);
}
/* Do not change owner so thread can clean up! */
}
- else if (Window->Wnd->pcls->style & CS_OWNDC) /* owned DCE*/
+ else if (Window->pcls->style & CS_OWNDC) /* owned DCE*/
{
pDCE = DceFreeDCE(pDCE, FALSE);
if (!pDCE) break;
else
{
DPRINT1("Not POWNED or CLASSDC hwndCurrent -> %x \n", pDCE->hwndCurrent);
- ASSERT(FALSE);
+ //ASSERT(FALSE);
}
}
else
* We should change this to DPRINT when ReactOS is more stable
* (for 1.0?).
*/
- DPRINT1("[%p] GetDC() without ReleaseDC()!\n", Window->hSelf);
+ DPRINT1("[%p] GetDC() without ReleaseDC()!\n", Window->head.h);
DceReleaseDC(pDCE, FALSE);
}
pDCE->DCXFlags |= DCX_DCEEMPTY;
}
VOID FASTCALL
-DceResetActiveDCEs(PWINDOW_OBJECT Window)
+DceResetActiveDCEs(PWND Window)
{
DCE *pDCE;
PDC dc;
- PWINDOW_OBJECT CurrentWindow;
+ PWND CurrentWindow;
INT DeltaX;
INT DeltaY;
PLIST_ENTRY pLE;
if(pLE == &LEDce) break;
if (0 == (pDCE->DCXFlags & (DCX_DCEEMPTY|DCX_INDESTROY)))
{
- if (Window->hSelf == pDCE->hwndCurrent)
+ if (Window->head.h == pDCE->hwndCurrent)
{
CurrentWindow = Window;
}
{
if (pDCE->DCXFlags & DCX_WINDOW)
{
- DeltaX = CurrentWindow->Wnd->rcWindow.left - dc->ptlDCOrig.x;
- DeltaY = CurrentWindow->Wnd->rcWindow.top - dc->ptlDCOrig.y;
- dc->ptlDCOrig.x = CurrentWindow->Wnd->rcWindow.left;
- dc->ptlDCOrig.y = CurrentWindow->Wnd->rcWindow.top;
+ DeltaX = CurrentWindow->rcWindow.left - dc->ptlDCOrig.x;
+ DeltaY = CurrentWindow->rcWindow.top - dc->ptlDCOrig.y;
+ dc->ptlDCOrig.x = CurrentWindow->rcWindow.left;
+ dc->ptlDCOrig.y = CurrentWindow->rcWindow.top;
}
else
{
- DeltaX = CurrentWindow->Wnd->rcClient.left - dc->ptlDCOrig.x;
- DeltaY = CurrentWindow->Wnd->rcClient.top - dc->ptlDCOrig.y;
- dc->ptlDCOrig.x = CurrentWindow->Wnd->rcClient.left;
- dc->ptlDCOrig.y = CurrentWindow->Wnd->rcClient.top;
+ DeltaX = CurrentWindow->rcClient.left - dc->ptlDCOrig.x;
+ DeltaY = CurrentWindow->rcClient.top - dc->ptlDCOrig.y;
+ dc->ptlDCOrig.x = CurrentWindow->rcClient.left;
+ dc->ptlDCOrig.y = CurrentWindow->rcClient.top;
}
if (NULL != dc->rosdc.hClipRgn)
{
DceUpdateVisRgn(pDCE, CurrentWindow, pDCE->DCXFlags);
- if (Window->hSelf != pDCE->hwndCurrent)
+ if (Window->head.h != pDCE->hwndCurrent)
{
// IntEngWindowChanged(CurrentWindow, WOC_RGN_CLIENT);
// UserDerefObject(CurrentWindow);
}
INT FASTCALL
-UserReleaseDC(PWINDOW_OBJECT Window, HDC hDc, BOOL EndPaint)
+UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
{
PDCE dce;
PLIST_ENTRY pLE;
}
HDC FASTCALL
-UserGetWindowDC(PWINDOW_OBJECT Wnd)
+UserGetWindowDC(PWND Wnd)
{
return UserGetDCEx(Wnd, 0, DCX_USESTYLE | DCX_WINDOW);
}
UserGethWnd( HDC hdc, PWNDOBJ *pwndo)
{
PWNDGDI pWndgdi;
- PWINDOW_OBJECT Wnd;
+ PWND Wnd;
HWND hWnd;
hWnd = IntWindowFromDC(hdc);
HDC APIENTRY
NtUserGetDCEx(HWND hWnd OPTIONAL, HANDLE ClipRegion, ULONG Flags)
{
- PWINDOW_OBJECT Wnd=NULL;
+ PWND Wnd=NULL;
DECLARE_RETURN(HDC);
DPRINT("Enter NtUserGetDCEx\n");