mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
- Support resursive locking of the GDI objects.
- Call EngMovePointer instead of DrvMovePointer if driver DrvSetPointerShape returned SPS_DECLINE. svn path=/trunk/; revision=9989
This commit is contained in:
parent
f5d1bff687
commit
9ac102fb17
5 changed files with 73 additions and 17 deletions
|
@ -116,6 +116,8 @@ typedef struct
|
|||
DRIVER_FUNCTIONS DriverFunctions;
|
||||
PFILE_OBJECT VideoFileObject;
|
||||
|
||||
PGD_MOVEPOINTER MovePointer;
|
||||
|
||||
struct {
|
||||
BOOL Enable;
|
||||
LONG Column;
|
||||
|
|
|
@ -49,7 +49,9 @@ typedef struct _GDIOBJHDR
|
|||
WORD Magic;
|
||||
const char* lockfile;
|
||||
int lockline;
|
||||
FAST_MUTEX Lock;
|
||||
/* FAST_MUTEX Lock;*/
|
||||
DWORD LockTid;
|
||||
DWORD LockCount;
|
||||
} GDIOBJHDR, *PGDIOBJHDR;
|
||||
|
||||
typedef struct _GDIMULTILOCK
|
||||
|
|
|
@ -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: input.c,v 1.35 2004/07/03 13:55:36 navaraf Exp $
|
||||
/* $Id: input.c,v 1.36 2004/07/04 01:23:32 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -640,14 +640,9 @@ IntMouseInput(MOUSEINPUT *mi)
|
|||
{
|
||||
SurfObj = &BitmapObj->SurfObj;
|
||||
|
||||
if(GDIDEVFUNCS(SurfObj).MovePointer)
|
||||
if (GDIDEV(SurfObj)->MovePointer)
|
||||
{
|
||||
GDIDEVFUNCS(SurfObj).MovePointer(
|
||||
SurfObj, MousePos.x, MousePos.y, &PointerRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
EngMovePointer(SurfObj, MousePos.x, MousePos.y, &PointerRect);
|
||||
GDIDEV(SurfObj)->MovePointer(SurfObj, MousePos.x, MousePos.y, &PointerRect);
|
||||
}
|
||||
|
||||
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||
|
|
|
@ -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: cursoricon.c,v 1.59 2004/07/03 17:40:27 navaraf Exp $ */
|
||||
/* $Id: cursoricon.c,v 1.60 2004/07/04 01:23:32 navaraf Exp $ */
|
||||
#include <w32k.h>
|
||||
|
||||
PCURICON_OBJECT FASTCALL
|
||||
|
@ -88,10 +88,8 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
|
|||
if (NULL != CurInfo->CurrentCursorObject && CurInfo->ShowingCursor)
|
||||
{
|
||||
/* Remove the cursor if it was displayed */
|
||||
if (GDIDEVFUNCS(SurfObj).MovePointer)
|
||||
GDIDEVFUNCS(SurfObj).MovePointer(SurfObj, -1, -1, &PointerRect);
|
||||
else
|
||||
EngMovePointer(SurfObj, -1, -1, &PointerRect);
|
||||
if (GDIDEV(SurfObj)->MovePointer)
|
||||
GDIDEV(SurfObj)->MovePointer(SurfObj, -1, -1, &PointerRect);
|
||||
SetPointerRect(CurInfo, &PointerRect);
|
||||
}
|
||||
|
||||
|
@ -174,13 +172,15 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
|
|||
CurInfo->y,
|
||||
&PointerRect,
|
||||
SPS_CHANGE);
|
||||
DbgPrint("SetCursor: DrvSetPointerShape() returned %x\n",
|
||||
GDIDEV(SurfObj)->PointerStatus);
|
||||
}
|
||||
else
|
||||
{
|
||||
GDIDEV(SurfObj)->PointerStatus = SPS_DECLINE;
|
||||
}
|
||||
|
||||
if(((GDIDEVICE *)SurfObj->hdev)->PointerStatus == SPS_DECLINE)
|
||||
if(GDIDEV(SurfObj)->PointerStatus == SPS_DECLINE)
|
||||
{
|
||||
GDIDEV(SurfObj)->PointerStatus = EngSetPointerShape(
|
||||
SurfObj, soMask, soColor, XlateObj,
|
||||
|
@ -190,7 +190,11 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
|
|||
CurInfo->y,
|
||||
&PointerRect,
|
||||
SPS_CHANGE);
|
||||
DbgPrint("SetCursor: DrvSetPointerShape() returned SPS_DECLINE\n");
|
||||
GDIDEV(SurfObj)->MovePointer = EngMovePointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
GDIDEV(SurfObj)->MovePointer = GDIDEVFUNCS(SurfObj).MovePointer;
|
||||
}
|
||||
|
||||
SetPointerRect(CurInfo, &PointerRect);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
/*
|
||||
* GDIOBJ.C - GDI object manipulation routines
|
||||
*
|
||||
* $Id: gdiobj.c,v 1.69 2004/07/03 13:55:36 navaraf Exp $
|
||||
* $Id: gdiobj.c,v 1.70 2004/07/04 01:23:32 navaraf Exp $
|
||||
*
|
||||
*/
|
||||
#include <w32k.h>
|
||||
|
@ -178,6 +178,7 @@ static HGDIOBJ StockObjects[NB_STOCK_OBJECTS];
|
|||
static PGDI_HANDLE_TABLE HandleTable = 0;
|
||||
static FAST_MUTEX HandleTableMutex;
|
||||
static FAST_MUTEX RefCountHandling;
|
||||
static LARGE_INTEGER ShortDelay;
|
||||
|
||||
/*!
|
||||
* Allocate GDI object table.
|
||||
|
@ -344,7 +345,12 @@ GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProc)
|
|||
newObject->Magic = GDI_TYPE_TO_MAGIC(ObjectType);
|
||||
newObject->lockfile = NULL;
|
||||
newObject->lockline = 0;
|
||||
#if 0
|
||||
ExInitializeFastMutex(&newObject->Lock);
|
||||
#else
|
||||
newObject->LockTid = 0;
|
||||
newObject->LockCount = 0;
|
||||
#endif
|
||||
HandleTable->Handles[Index] = newObject;
|
||||
#if GDI_COUNT_OBJECTS
|
||||
HandleTable->HandlesCount++;
|
||||
|
@ -550,6 +556,8 @@ InitGdiObjectHandleTable (VOID)
|
|||
ExInitializeFastMutex (&HandleTableMutex);
|
||||
ExInitializeFastMutex (&RefCountHandling);
|
||||
|
||||
ShortDelay.QuadPart = -100;
|
||||
|
||||
HandleTable = GDIOBJ_iAllocHandleTable (GDI_HANDLE_COUNT);
|
||||
DPRINT("HandleTable: %x\n", HandleTable );
|
||||
|
||||
|
@ -704,6 +712,7 @@ GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef NDEBUG
|
||||
ExAcquireFastMutex(&ObjHdr->Lock);
|
||||
#else /* NDEBUG */
|
||||
|
@ -719,6 +728,24 @@ GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ hObj, DWORD ObjectType)
|
|||
DPRINT1(" Disregard previous message about object 0x%x, it's ok\n", hObj);
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
#else
|
||||
if (ObjHdr->LockTid == (DWORD)PsGetCurrentThreadId())
|
||||
{
|
||||
InterlockedIncrement(&ObjHdr->LockCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (InterlockedCompareExchange(&ObjHdr->LockTid, (DWORD)PsGetCurrentThreadId(), 0))
|
||||
{
|
||||
InterlockedIncrement(&ObjHdr->LockCount);
|
||||
break;
|
||||
}
|
||||
/* FIXME: KeDelayExecutionThread(KernelMode, FALSE, &ShortDelay); */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ExAcquireFastMutex(&RefCountHandling);
|
||||
ObjHdr->dwCount++;
|
||||
|
@ -780,7 +807,26 @@ GDIOBJ_LockObj(HGDIOBJ hObj, DWORD ObjectType)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
ExAcquireFastMutex(&ObjHdr->Lock);
|
||||
#else
|
||||
if (ObjHdr->LockTid == (DWORD)PsGetCurrentThreadId())
|
||||
{
|
||||
InterlockedIncrement(&ObjHdr->LockCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (InterlockedCompareExchange(&ObjHdr->LockTid, (DWORD)PsGetCurrentThreadId(), 0))
|
||||
{
|
||||
InterlockedIncrement(&ObjHdr->LockCount);
|
||||
break;
|
||||
}
|
||||
/* FIXME: KeDelayExecutionThread(KernelMode, FALSE, &ShortDelay); */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ExAcquireFastMutex(&RefCountHandling);
|
||||
ObjHdr->dwCount++;
|
||||
|
@ -813,7 +859,14 @@ GDIOBJ_UnlockObj(HGDIOBJ hObj, DWORD ObjectType)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
ExReleaseFastMutex(&ObjHdr->Lock);
|
||||
#else
|
||||
if (InterlockedDecrement(&ObjHdr->LockCount) == 0)
|
||||
{
|
||||
InterlockedExchange(&ObjHdr->LockTid, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
ExAcquireFastMutex(&RefCountHandling);
|
||||
if (0 == (ObjHdr->dwCount & ~0x80000000))
|
||||
|
|
Loading…
Reference in a new issue