/* INCLUDES ******************************************************************/
-#include <w32k.h>
+#include <win32k.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
/* NOTE - I think we should store this per window station (including gdi objects) */
+/* Answer: No, use the DCE pMonitor to compare with! */
-static PDCE FirstDce = NULL;
-//static INT DCECount = 0; // Count of DCE in system.
+static LIST_ENTRY LEDce;
+static INT DCECount = 0; // Count of DCE in system.
#define DCX_CACHECOMPAREMASK (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | \
DCX_NORESETATTRS | DCX_LOCKWINDOWUPDATE | \
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!
//
defaultDCstate->pdcattr = &defaultDCstate->dcattr;
DC_vCopyState(dc, defaultDCstate, TRUE);
DC_UnlockDc( dc );
+ InitializeListHead(&LEDce);
}
return hDC;
}
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)
ExFreePoolWithTag(pDce, TAG_PDCE);
return NULL;
}
-
- pDce->hwndCurrent = (Window ? Window->hSelf : NULL);
- pDce->pwndOrg = Wnd;
- pDce->pwndClip = Wnd;
+ DCECount++;
+ DPRINT("Alloc DCE's! %d\n",DCECount);
+ pDce->hwndCurrent = (Window ? Window->head.h : NULL);
+ pDce->pwndOrg = Window;
+ pDce->pwndClip = Window;
pDce->hrgnClip = NULL;
pDce->hrgnClipPublic = NULL;
pDce->hrgnSavedVis = NULL;
pDce->ppiOwner = NULL;
- KeEnterCriticalRegion();
- if (FirstDce == NULL)
- {
- FirstDce = pDce;
- InitializeListHead(&FirstDce->List);
- }
- else
- InsertTailList(&FirstDce->List, &pDce->List);
- KeLeaveCriticalRegion();
+ InsertTailList(&LEDce, &pDce->List);
DCU_SetDcUndeletable(pDce->hDC);
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);
}
else if (Dce->hrgnClip != NULL)
{
- REGION_FreeRgnByHandle(Dce->hrgnClip);
+ GDIOBJ_FreeObjByHandle(Dce->hrgnClip, GDI_OBJECT_TYPE_REGION|GDI_OBJECT_TYPE_SILENT);
}
Dce->hrgnClip = NULL;
static INT FASTCALL
DceReleaseDC(DCE* dce, BOOL EndPaint)
{
- if (DCX_DCEBUSY != (dce->DCXFlags & (DCX_DCEEMPTY | DCX_DCEBUSY)))
+ if (DCX_DCEBUSY != (dce->DCXFlags & (DCX_INDESTROY | DCX_DCEEMPTY | DCX_DCEBUSY)))
{
return 0;
}
/* restore previous visible region */
-
if ((dce->DCXFlags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) &&
((dce->DCXFlags & DCX_CACHE) || EndPaint))
{
if (dce->DCXFlags & DCX_CACHE)
{
- if (!(dce->DCXFlags & DCX_NORESETATTRS))
- {
- /* make the DC clean so that SetDCState doesn't try to update the vis rgn */
- IntGdiSetHookFlags(dce->hDC, DCHF_VALIDATEVISRGN);
+ if (!(dce->DCXFlags & DCX_NORESETATTRS))
+ {
+ /* make the DC clean so that SetDCState doesn't try to update the vis rgn */
+ IntGdiSetHookFlags(dce->hDC, DCHF_VALIDATEVISRGN);
- // Clean the DC
- if (!IntGdiCleanDC(dce->hDC)) return 0;
+ // Clean the DC
+ if (!IntGdiCleanDC(dce->hDC)) return 0;
- if (dce->DCXFlags & DCX_DCEDIRTY)
- {
- /* don't keep around invalidated entries
- * because SetDCState() disables hVisRgn updates
- * by removing dirty bit. */
- dce->hwndCurrent = 0;
- dce->DCXFlags &= DCX_CACHE;
- dce->DCXFlags |= DCX_DCEEMPTY;
- }
- }
- dce->DCXFlags &= ~DCX_DCEBUSY;
- DPRINT("Exit!!!!! DCX_CACHE!!!!!! hDC-> %x \n", dce->hDC);
- if (!IntGdiSetDCOwnerEx( dce->hDC, GDI_OBJ_HMGR_NONE, FALSE))
- return 0;
- dce->ptiOwner = NULL; // Reset ownership.
- dce->ppiOwner = NULL;
+ if (dce->DCXFlags & DCX_DCEDIRTY)
+ {
+ /* don't keep around invalidated entries
+ * because SetDCState() disables hVisRgn updates
+ * by removing dirty bit. */
+ dce->hwndCurrent = 0;
+ dce->DCXFlags &= DCX_CACHE;
+ dce->DCXFlags |= DCX_DCEEMPTY;
+ }
+ }
+ dce->DCXFlags &= ~DCX_DCEBUSY;
+ DPRINT("Exit!!!!! DCX_CACHE!!!!!! hDC-> %x \n", dce->hDC);
+ if (!IntGdiSetDCOwnerEx( dce->hDC, GDI_OBJ_HMGR_NONE, FALSE))
+ return 0;
+ dce->ptiOwner = NULL; // Reset ownership.
+ dce->ppiOwner = NULL;
+
+#if 0 // Need to research and fix before this is a "growing" issue.
+ if (++DCECache > 32)
+ {
+ pLE = LEDce.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+ do
+ {
+ if (!(pDCE->DCXFlags & DCX_DCEBUSY))
+ { /* Free the unused cache DCEs. */
+ pDCE = DceFreeDCE(pDCE, TRUE);
+ if (!pDCE) break;
+ continue;
+ }
+ }
+ while (pLE != &LEDce );
+ }
+#endif
}
return 1; // Released!
}
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;
}
DCE* DceEmpty = NULL;
DCE* DceUnused = NULL;
KeEnterCriticalRegion();
- Dce = FirstDce;
+ pLE = LEDce.Flink;
+ Dce = CONTAINING_RECORD(pLE, DCE, List);
do
{
// The reason for this you may ask?
{
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;
break;
}
}
- Dce = (PDCE)Dce->List.Flink;
- } while (Dce != FirstDce);
+ pLE = Dce->List.Flink;
+ Dce = CONTAINING_RECORD(pLE, DCE, List);
+ }
+ while (pLE != &LEDce);
KeLeaveCriticalRegion();
Dce = (DceEmpty == NULL) ? DceUnused : DceEmpty;
}
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.
{
KeEnterCriticalRegion();
- Dce = FirstDce;
+ pLE = LEDce.Flink;
+ 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;
- Dce = (PDCE)Dce->List.Flink;
- } while (Dce != FirstDce);
+ pLE = Dce->List.Flink;
+ Dce = CONTAINING_RECORD(pLE, DCE, List);
+ }
+ while (pLE != &LEDce);
KeLeaveCriticalRegion();
if ( (Flags & (DCX_INTERSECTRGN|DCX_EXCLUDERGN)) &&
http://www.reactos.org/archives/public/ros-dev/2008-July/010498.html
http://www.reactos.org/archives/public/ros-dev/2008-July/010499.html
*/
- if ((Dce != FirstDce))
+ if (pLE != &LEDce)
{
RemoveEntryList(&Dce->List);
- InsertHeadList(&FirstDce->List, &Dce->List);
- FirstDce = Dce;
+ InsertHeadList(&LEDce, &Dce->List);
}
/* Introduced in rev 6691 and modified later. */
{
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;
}
else if (ClipRegion != NULL)
{
+ if (Dce->hrgnClip != NULL)
+ {
+ DPRINT1("Should not be called!!\n");
+ GDIOBJ_FreeObjByHandle(Dce->hrgnClip, GDI_OBJECT_TYPE_REGION|GDI_OBJECT_TYPE_SILENT);
+ Dce->hrgnClip = NULL;
+ }
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)
{
DceFreeDCE(PDCE pdce, BOOLEAN Force)
{
DCE *ret;
+ PLIST_ENTRY pLE;
BOOL Hit = FALSE;
if (NULL == pdce) return NULL;
- ret = (PDCE) pdce->List.Flink;
+ pLE = pdce->List.Flink;
+ ret = CONTAINING_RECORD(pLE, DCE, List);
-#if 0 /* FIXME */
- SetDCHook(pdce->hDC, NULL, 0L);
-#endif
+ pdce->DCXFlags |= DCX_INDESTROY;
if (Force && !GDIOBJ_OwnedByCurrentProcess(pdce->hDC))
{
Hit = TRUE;
}
}
+ else
+ {
+ if (!GreGetObjectOwner(pdce->hDC, GDIObjType_DC_TYPE))
+ DC_SetOwnership( pdce->hDC, PsGetCurrentProcess());
+ }
if (!Hit) IntGdiDeleteDC(pdce->hDC, TRUE);
- if (pdce->hrgnClip && ! (pdce->DCXFlags & DCX_KEEPCLIPRGN))
+ if (pdce->hrgnClip && !(pdce->DCXFlags & DCX_KEEPCLIPRGN))
{
- REGION_FreeRgnByHandle(pdce->hrgnClip);
+ GDIOBJ_FreeObjByHandle(pdce->hrgnClip, GDI_OBJECT_TYPE_REGION|GDI_OBJECT_TYPE_SILENT);
+ pdce->hrgnClip = NULL;
}
RemoveEntryList(&pdce->List);
if (IsListEmpty(&pdce->List))
{
DPRINT1("List is Empty! DCE! -> %x\n" , pdce);
- FirstDce = NULL;
- ret = NULL;
+ return NULL;
}
ExFreePoolWithTag(pdce, TAG_PDCE);
+ DCECount--;
+ DPRINT("Freed DCE's! %d \n", DCECount);
+
return ret;
}
+/***********************************************************************
+ * DceFreeWindowDCE
+ *
+ * Remove owned DCE and reset unreleased cache DCEs.
+ */
+void FASTCALL
+DceFreeWindowDCE(PWND Window)
+{
+ PDCE pDCE;
+ PLIST_ENTRY pLE;
+
+ if (DCECount <= 0)
+ {
+ DPRINT1("FreeWindowDCE No Entry! %d\n",DCECount);
+ return;
+ }
+
+ pLE = LEDce.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+ do
+ {
+ if (!pDCE)
+ {
+ DPRINT1("FreeWindowDCE No DCE Pointer!\n");
+ break;
+ }
+ if (IsListEmpty(&pDCE->List))
+ {
+ DPRINT1("FreeWindowDCE List is Empty!!!!\n");
+ break;
+ }
+ if ( pDCE->hwndCurrent == Window->head.h &&
+ !(pDCE->DCXFlags & DCX_DCEEMPTY) )
+ {
+ if (!(pDCE->DCXFlags & DCX_CACHE)) /* owned or Class DCE*/
+ {
+ if (Window->pcls->style & CS_CLASSDC) /* Test Class first */
+ {
+ if (pDCE->DCXFlags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) /* Class DCE*/
+ DceDeleteClipRgn(pDCE);
+ // Update and reset Vis Rgn and clear the dirty bit.
+ // Should release VisRgn than reset it to default.
+ DceUpdateVisRgn(pDCE, Window, pDCE->DCXFlags);
+ pDCE->DCXFlags = DCX_DCEEMPTY|DCX_CACHE;
+ pDCE->hwndCurrent = 0;
+
+ DPRINT("POWNED DCE going Cheap!! DCX_CACHE!! hDC-> %x \n", pDCE->hDC);
+ if (!IntGdiSetDCOwnerEx( pDCE->hDC, GDI_OBJ_HMGR_NONE, FALSE))
+ {
+ DPRINT1("Fail Owner Switch hDC-> %x \n", pDCE->hDC);
+ break;
+ }
+ /* Do not change owner so thread can clean up! */
+ }
+ else if (Window->pcls->style & CS_OWNDC) /* owned DCE*/
+ {
+ pDCE = DceFreeDCE(pDCE, FALSE);
+ if (!pDCE) break;
+ continue;
+ }
+ else
+ {
+ DPRINT1("Not POWNED or CLASSDC hwndCurrent -> %x \n", pDCE->hwndCurrent);
+ //ASSERT(FALSE);
+ }
+ }
+ else
+ {
+ if (pDCE->DCXFlags & DCX_DCEBUSY) /* shared cache DCE */
+ {
+ /* FIXME: AFAICS we are doing the right thing here so
+ * this should be a DPRINT. But this is best left as an ERR
+ * because the 'application error' is likely to come from
+ * another part of Wine (i.e. it's our fault after all).
+ * We should change this to DPRINT when ReactOS is more stable
+ * (for 1.0?).
+ */
+ DPRINT1("[%p] GetDC() without ReleaseDC()!\n", Window->head.h);
+ DceReleaseDC(pDCE, FALSE);
+ }
+ pDCE->DCXFlags |= DCX_DCEEMPTY;
+ pDCE->hwndCurrent = 0;
+ }
+ }
+ pLE = pDCE->List.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+ }
+ while (pLE != &LEDce);
+}
+
void FASTCALL
DceFreeClassDCE(HDC hDC)
{
- PDCE pDCE = FirstDce;
- KeEnterCriticalRegion();
+ PDCE pDCE;
+ PLIST_ENTRY pLE;
+ pLE = LEDce.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+
do
{
if(!pDCE) break;
if (pDCE->hDC == hDC)
{
- pDCE = DceFreeDCE(pDCE, FALSE);
- if(!pDCE) break;
+ pDCE = DceFreeDCE(pDCE, TRUE); // Might have gone cheap!
+ if (!pDCE) break;
continue;
}
- pDCE = (PDCE)pDCE->List.Flink;
- } while (pDCE != FirstDce);
- KeLeaveCriticalRegion();
+ pLE = pDCE->List.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+ }
+ while (pLE != &LEDce);
+}
+
+void FASTCALL
+DceFreeThreadDCE(PTHREADINFO pti)
+{
+ PDCE pDCE;
+ PLIST_ENTRY pLE;
+ pLE = LEDce.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+
+ do
+ {
+ if(!pDCE) break;
+ if (pDCE->ptiOwner == pti)
+ {
+ if (pDCE->DCXFlags & DCX_CACHE)
+ {
+ pDCE = DceFreeDCE(pDCE, TRUE);
+ if (!pDCE) break;
+ continue;
+ }
+ }
+ pLE = pDCE->List.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+ }
+ while (pLE != &LEDce);
}
VOID FASTCALL
DceEmptyCache(VOID)
{
- PDCE pDCE = FirstDce;
- KeEnterCriticalRegion();
+ PDCE pDCE;
+ PLIST_ENTRY pLE;
+ pLE = LEDce.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+
do
{
if(!pDCE) break;
pDCE = DceFreeDCE(pDCE, TRUE);
if(!pDCE) break;
- } while (pDCE != FirstDce);
- KeLeaveCriticalRegion();
- FirstDce = NULL;
+ }
+ while (pLE != &LEDce);
}
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 (NULL == Window)
{
return;
}
- pDCE = FirstDce;
+ pLE = LEDce.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
if(!pDCE) return; // Another null test!
do
{
if(!pDCE) break;
- if (0 == (pDCE->DCXFlags & DCX_DCEEMPTY))
+ 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;
}
CurrentWindow = UserGetWindowObject(pDCE->hwndCurrent);
if (NULL == CurrentWindow)
{
- pDCE = (PDCE) pDCE->List.Flink;
+ pLE = pDCE->List.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
continue;
}
}
if (!GDIOBJ_ValidateHandle(pDCE->hDC, GDI_OBJECT_TYPE_DC) ||
(dc = DC_LockDc(pDCE->hDC)) == NULL)
{
- pDCE = (PDCE) pDCE->List.Flink;
+ pLE = pDCE->List.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
continue;
}
if (Window == CurrentWindow || IntIsChildWindow(Window, CurrentWindow))
{
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);
}
}
- pDCE =(PDCE) pDCE->List.Flink;
- } while (pDCE != FirstDce);
+ pLE = pDCE->List.Flink;
+ pDCE = CONTAINING_RECORD(pLE, DCE, List);
+ }
+ while (pLE != &LEDce);
}
HWND FASTCALL
IntWindowFromDC(HDC hDc)
{
DCE *Dce;
+ PLIST_ENTRY pLE;
HWND Ret = NULL;
- KeEnterCriticalRegion();
- Dce = FirstDce;
+
+ pLE = LEDce.Flink;
+ Dce = CONTAINING_RECORD(pLE, DCE, List);
do
{
- if(Dce->hDC == hDc)
+ if (Dce->hDC == hDc)
{
- Ret = Dce->hwndCurrent;
+ if (Dce->DCXFlags & DCX_INDESTROY)
+ Ret = NULL;
+ else
+ Ret = Dce->hwndCurrent;
break;
}
- Dce = (PDCE)Dce->List.Flink;
- } while (Dce != FirstDce);
- KeLeaveCriticalRegion();
+ pLE = Dce->List.Flink;
+ Dce = CONTAINING_RECORD(pLE, DCE, List);
+ }
+ while (pLE != &LEDce);
return Ret;
}
INT FASTCALL
-UserReleaseDC(PWINDOW_OBJECT Window, HDC hDc, BOOL EndPaint)
+UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
{
PDCE dce;
+ PLIST_ENTRY pLE;
INT nRet = 0;
BOOL Hit = FALSE;
DPRINT("%p %p\n", Window, hDc);
- dce = FirstDce;
- KeEnterCriticalRegion();
+ pLE = LEDce.Flink;
+ dce = CONTAINING_RECORD(pLE, DCE, List);
do
{
if(!dce) break;
Hit = TRUE;
break;
}
-
- dce = (PDCE) dce->List.Flink;
+ pLE = dce->List.Flink;
+ dce = CONTAINING_RECORD(pLE, DCE, List);
}
- while (dce != FirstDce );
- KeLeaveCriticalRegion();
+ while (pLE != &LEDce );
if ( Hit && (dce->DCXFlags & DCX_DCEBUSY))
{
}
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");