mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
made the DCE list thread-safe
svn path=/trunk/; revision=8978
This commit is contained in:
parent
c89da97139
commit
0a205b8bd5
1 changed files with 40 additions and 12 deletions
|
@ -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.61 2004/03/23 18:08:07 weiden Exp $
|
||||
/* $Id: windc.c,v 1.62 2004/04/05 20:46:15 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -49,14 +49,26 @@
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
/* NOTE - I think we should store this per window station (including gdi objects) */
|
||||
|
||||
static FAST_MUTEX DceListLock;
|
||||
static PDCE FirstDce = NULL;
|
||||
static HDC defaultDCstate;
|
||||
|
||||
#define DCE_LockList ExAcquireFastMutex(&DceListLock)
|
||||
#define DCE_UnlockList ExReleaseFastMutex(&DceListLock)
|
||||
|
||||
#define DCX_CACHECOMPAREMASK (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | \
|
||||
DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID FASTCALL
|
||||
DceInit(VOID)
|
||||
{
|
||||
ExInitializeFastMutex(&DceListLock);
|
||||
}
|
||||
|
||||
HRGN STDCALL
|
||||
DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags)
|
||||
{
|
||||
|
@ -111,8 +123,10 @@ DceAllocDCE(HWND hWnd, DCE_TYPE Type)
|
|||
}
|
||||
Dce->hwndCurrent = hWnd;
|
||||
Dce->hClipRgn = NULL;
|
||||
DCE_LockList;
|
||||
Dce->next = FirstDce;
|
||||
FirstDce = Dce;
|
||||
DCE_UnlockList;
|
||||
|
||||
if (Type != DCE_CACHE_DC)
|
||||
{
|
||||
|
@ -408,6 +422,8 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
|
|||
{
|
||||
DCE* DceEmpty = NULL;
|
||||
DCE* DceUnused = NULL;
|
||||
|
||||
DCE_LockList;
|
||||
|
||||
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
|
||||
{
|
||||
|
@ -430,6 +446,8 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
|
|||
}
|
||||
}
|
||||
|
||||
DCE_UnlockList;
|
||||
|
||||
if (Dce == NULL)
|
||||
{
|
||||
Dce = (DceEmpty == NULL) ? DceEmpty : DceUnused;
|
||||
|
@ -555,7 +573,9 @@ BOOL FASTCALL
|
|||
DCE_InternalDelete(PDCE Dce)
|
||||
{
|
||||
PDCE PrevInList;
|
||||
|
||||
|
||||
DCE_LockList;
|
||||
|
||||
if (Dce == FirstDce)
|
||||
{
|
||||
FirstDce = Dce->next;
|
||||
|
@ -574,6 +594,8 @@ DCE_InternalDelete(PDCE Dce)
|
|||
assert(NULL != PrevInList);
|
||||
}
|
||||
|
||||
DCE_UnlockList;
|
||||
|
||||
return NULL != PrevInList;
|
||||
}
|
||||
|
||||
|
@ -581,13 +603,17 @@ HWND FASTCALL
|
|||
IntWindowFromDC(HDC hDc)
|
||||
{
|
||||
DCE *Dce;
|
||||
|
||||
DCE_LockList;
|
||||
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
|
||||
{
|
||||
if(Dce->hDC == hDc)
|
||||
{
|
||||
DCE_UnlockList;
|
||||
return Dce->hwndCurrent;
|
||||
}
|
||||
}
|
||||
DCE_UnlockList;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -597,7 +623,8 @@ NtUserReleaseDC(HWND hWnd, HDC hDc)
|
|||
DCE *dce;
|
||||
INT nRet = 0;
|
||||
|
||||
/* FIXME USER_Lock(); */
|
||||
DCE_LockList;
|
||||
|
||||
dce = FirstDce;
|
||||
|
||||
DPRINT("%p %p\n", hWnd, hDc);
|
||||
|
@ -612,7 +639,7 @@ NtUserReleaseDC(HWND hWnd, HDC hDc)
|
|||
nRet = DceReleaseDC(dce);
|
||||
}
|
||||
|
||||
/* FIXME USER_Unlock(); */
|
||||
DCE_UnlockList;
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
@ -631,16 +658,8 @@ DceFreeDCE(PDCE dce)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if 0 /* FIXME */
|
||||
USER_Lock();
|
||||
#endif
|
||||
|
||||
ret = dce->next;
|
||||
|
||||
#if 0 /* FIXME */
|
||||
USER_Unlock();
|
||||
#endif
|
||||
|
||||
#if 0 /* FIXME */
|
||||
SetDCHook(dce->hDC, NULL, 0L);
|
||||
#endif
|
||||
|
@ -668,6 +687,8 @@ DceFreeWindowDCE(PWINDOW_OBJECT Window)
|
|||
{
|
||||
DCE *pDCE;
|
||||
|
||||
DCE_LockList;
|
||||
|
||||
pDCE = FirstDce;
|
||||
while (pDCE)
|
||||
{
|
||||
|
@ -709,15 +730,18 @@ DceFreeWindowDCE(PWINDOW_OBJECT Window)
|
|||
}
|
||||
pDCE = pDCE->next;
|
||||
}
|
||||
DCE_UnlockList;
|
||||
}
|
||||
|
||||
void FASTCALL
|
||||
DceEmptyCache()
|
||||
{
|
||||
DCE_LockList;
|
||||
while (FirstDce != NULL)
|
||||
{
|
||||
DceFreeDCE(FirstDce);
|
||||
}
|
||||
DCE_UnlockList;
|
||||
}
|
||||
|
||||
VOID FASTCALL
|
||||
|
@ -732,6 +756,8 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window, int DeltaX, int DeltaY)
|
|||
return;
|
||||
}
|
||||
|
||||
DCE_LockList;
|
||||
|
||||
pDCE = FirstDce;
|
||||
while (pDCE)
|
||||
{
|
||||
|
@ -785,6 +811,8 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window, int DeltaX, int DeltaY)
|
|||
}
|
||||
pDCE = pDCE->next;
|
||||
}
|
||||
|
||||
DCE_UnlockList;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue