Remove no longer used PERQUEUEDATA structure and functions.
This commit is contained in:
parent
a9e8f59c95
commit
618c18417b
|
@ -29,22 +29,6 @@
|
|||
|
||||
#define WH_NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1)
|
||||
|
||||
/* Per-queue data for the message queue
|
||||
* Note that we currently only store the current values for
|
||||
* Active, Capture and Focus windows currently.
|
||||
* It might be necessary to store a pointer to the system message queue
|
||||
* as well since windows 9x maintains per thread system message queues
|
||||
*/
|
||||
typedef struct tagPERQUEUEDATA
|
||||
{
|
||||
HWND hWndFocus; /* Focus window */
|
||||
HWND hWndActive; /* Active window */
|
||||
HWND hWndCapture; /* Capture window */
|
||||
INT16 nCaptureHT; /* Capture info (hit-test) */
|
||||
ULONG ulRefCount; /* Reference count */
|
||||
CRITICAL_SECTION cSection; /* Critical section for thread safe access */
|
||||
} PERQUEUEDATA;
|
||||
|
||||
struct received_message_info;
|
||||
|
||||
/* Message queue */
|
||||
|
@ -68,23 +52,12 @@ typedef struct tagMESSAGEQUEUE
|
|||
|
||||
HANDLE16 hCurHook; /* Current hook */
|
||||
HANDLE16 hooks[WH_NB_HOOKS]; /* Task hooks list */
|
||||
|
||||
PERQUEUEDATA *pQData; /* pointer to (shared) PERQUEUEDATA structure */
|
||||
|
||||
} MESSAGEQUEUE;
|
||||
|
||||
|
||||
#define QUEUE_MAGIC 0xD46E80AF
|
||||
#define MAX_SENDMSG_RECURSION 64
|
||||
|
||||
/* Per queue data management methods */
|
||||
HWND PERQDATA_GetFocusWnd( PERQUEUEDATA *pQData );
|
||||
HWND PERQDATA_SetFocusWnd( PERQUEUEDATA *pQData, HWND hWndFocus );
|
||||
HWND PERQDATA_GetActiveWnd( PERQUEUEDATA *pQData );
|
||||
HWND PERQDATA_SetActiveWnd( PERQUEUEDATA *pQData, HWND hWndActive );
|
||||
HWND PERQDATA_GetCaptureWnd( INT *hittest );
|
||||
HWND PERQDATA_SetCaptureWnd( HWND hWndCapture, INT hittest );
|
||||
|
||||
/* Message queue management methods */
|
||||
extern MESSAGEQUEUE *QUEUE_Current(void);
|
||||
extern MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue );
|
||||
|
|
242
windows/queue.c
242
windows/queue.c
|
@ -38,230 +38,6 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(msg);
|
||||
|
||||
|
||||
static PERQUEUEDATA *pQDataWin16 = NULL; /* Global perQData for Win16 tasks */
|
||||
|
||||
HQUEUE16 hActiveQueue = 0;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_Addref
|
||||
*
|
||||
* Increment reference count for the PERQUEUEDATA instance
|
||||
* Returns reference count for debugging purposes
|
||||
*/
|
||||
static void PERQDATA_Addref( PERQUEUEDATA *pQData )
|
||||
{
|
||||
assert(pQData != 0 );
|
||||
TRACE_(msg)("(): current refcount %lu ...\n", pQData->ulRefCount);
|
||||
|
||||
InterlockedIncrement( &pQData->ulRefCount );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_Release
|
||||
*
|
||||
* Release a reference to a PERQUEUEDATA instance.
|
||||
* Destroy the instance if no more references exist
|
||||
* Returns reference count for debugging purposes
|
||||
*/
|
||||
static void PERQDATA_Release( PERQUEUEDATA *pQData )
|
||||
{
|
||||
assert(pQData != 0 );
|
||||
TRACE_(msg)("(): current refcount %lu ...\n",
|
||||
(LONG)pQData->ulRefCount );
|
||||
|
||||
if (!InterlockedDecrement( &pQData->ulRefCount ))
|
||||
{
|
||||
DeleteCriticalSection( &pQData->cSection );
|
||||
|
||||
TRACE_(msg)("(): deleting PERQUEUEDATA instance ...\n" );
|
||||
|
||||
/* Deleting our global 16 bit perQData? */
|
||||
if ( pQData == pQDataWin16 ) pQDataWin16 = 0;
|
||||
|
||||
/* Free the PERQUEUEDATA instance */
|
||||
HeapFree( GetProcessHeap(), 0, pQData );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_CreateInstance
|
||||
*
|
||||
* Creates an instance of a reference counted PERQUEUEDATA element
|
||||
* for the message queue. perQData is stored globally for 16 bit tasks.
|
||||
*
|
||||
* Note: We don't implement perQdata exactly the same way Windows does.
|
||||
* Each perQData element is reference counted since it may be potentially
|
||||
* shared by multiple message Queues (via AttachThreadInput).
|
||||
* We only store the current values for Active, Capture and focus windows
|
||||
* currently.
|
||||
*/
|
||||
static PERQUEUEDATA * PERQDATA_CreateInstance(void)
|
||||
{
|
||||
PERQUEUEDATA *pQData;
|
||||
|
||||
BOOL16 bIsWin16 = 0;
|
||||
|
||||
TRACE_(msg)("()\n");
|
||||
|
||||
/* Share a single instance of perQData for all 16 bit tasks */
|
||||
if ( ( bIsWin16 = !(NtCurrentTeb()->tibflags & TEBF_WIN32) ) )
|
||||
{
|
||||
/* If previously allocated, just bump up ref count */
|
||||
if ( pQDataWin16 )
|
||||
{
|
||||
PERQDATA_Addref( pQDataWin16 );
|
||||
return pQDataWin16;
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate PERQUEUEDATA from the system heap */
|
||||
if (!( pQData = (PERQUEUEDATA *) HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(PERQUEUEDATA) ) ))
|
||||
return 0;
|
||||
|
||||
/* Initialize */
|
||||
pQData->hWndCapture = pQData->hWndFocus = pQData->hWndActive = 0;
|
||||
pQData->ulRefCount = 1;
|
||||
pQData->nCaptureHT = HTCLIENT;
|
||||
|
||||
/* Note: We have an independent critical section for the per queue data
|
||||
* since this may be shared by different threads. see AttachThreadInput()
|
||||
*/
|
||||
InitializeCriticalSection( &pQData->cSection );
|
||||
/* FIXME: not all per queue data critical sections should be global */
|
||||
MakeCriticalSectionGlobal( &pQData->cSection );
|
||||
|
||||
/* Save perQData globally for 16 bit tasks */
|
||||
if ( bIsWin16 )
|
||||
pQDataWin16 = pQData;
|
||||
|
||||
return pQData;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_GetFocusWnd
|
||||
*
|
||||
* Get the focus hwnd member in a threadsafe manner
|
||||
*/
|
||||
HWND PERQDATA_GetFocusWnd( PERQUEUEDATA *pQData )
|
||||
{
|
||||
HWND hWndFocus;
|
||||
assert(pQData != 0 );
|
||||
|
||||
EnterCriticalSection( &pQData->cSection );
|
||||
hWndFocus = pQData->hWndFocus;
|
||||
LeaveCriticalSection( &pQData->cSection );
|
||||
|
||||
return hWndFocus;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_SetFocusWnd
|
||||
*
|
||||
* Set the focus hwnd member in a threadsafe manner
|
||||
*/
|
||||
HWND PERQDATA_SetFocusWnd( PERQUEUEDATA *pQData, HWND hWndFocus )
|
||||
{
|
||||
HWND hWndFocusPrv;
|
||||
assert(pQData != 0 );
|
||||
|
||||
EnterCriticalSection( &pQData->cSection );
|
||||
hWndFocusPrv = pQData->hWndFocus;
|
||||
pQData->hWndFocus = hWndFocus;
|
||||
LeaveCriticalSection( &pQData->cSection );
|
||||
|
||||
return hWndFocusPrv;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_GetActiveWnd
|
||||
*
|
||||
* Get the active hwnd member in a threadsafe manner
|
||||
*/
|
||||
HWND PERQDATA_GetActiveWnd( PERQUEUEDATA *pQData )
|
||||
{
|
||||
HWND hWndActive;
|
||||
assert(pQData != 0 );
|
||||
|
||||
EnterCriticalSection( &pQData->cSection );
|
||||
hWndActive = pQData->hWndActive;
|
||||
LeaveCriticalSection( &pQData->cSection );
|
||||
|
||||
return hWndActive;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_SetActiveWnd
|
||||
*
|
||||
* Set the active focus hwnd member in a threadsafe manner
|
||||
*/
|
||||
HWND PERQDATA_SetActiveWnd( PERQUEUEDATA *pQData, HWND hWndActive )
|
||||
{
|
||||
HWND hWndActivePrv;
|
||||
assert(pQData != 0 );
|
||||
|
||||
EnterCriticalSection( &pQData->cSection );
|
||||
hWndActivePrv = pQData->hWndActive;
|
||||
pQData->hWndActive = hWndActive;
|
||||
LeaveCriticalSection( &pQData->cSection );
|
||||
|
||||
return hWndActivePrv;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_GetCaptureWnd
|
||||
*
|
||||
* Get the capture hwnd member in a threadsafe manner
|
||||
*/
|
||||
HWND PERQDATA_GetCaptureWnd( INT *hittest )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
PERQUEUEDATA *pQData;
|
||||
HWND hWndCapture;
|
||||
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
pQData = queue->pQData;
|
||||
|
||||
EnterCriticalSection( &pQData->cSection );
|
||||
hWndCapture = pQData->hWndCapture;
|
||||
*hittest = pQData->nCaptureHT;
|
||||
LeaveCriticalSection( &pQData->cSection );
|
||||
return hWndCapture;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PERQDATA_SetCaptureWnd
|
||||
*
|
||||
* Set the capture hwnd member in a threadsafe manner
|
||||
*/
|
||||
HWND PERQDATA_SetCaptureWnd( HWND hWndCapture, INT hittest )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
PERQUEUEDATA *pQData;
|
||||
HWND hWndCapturePrv;
|
||||
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
pQData = queue->pQData;
|
||||
|
||||
EnterCriticalSection( &pQData->cSection );
|
||||
hWndCapturePrv = pQData->hWndCapture;
|
||||
pQData->hWndCapture = hWndCapture;
|
||||
pQData->nCaptureHT = hittest;
|
||||
LeaveCriticalSection( &pQData->cSection );
|
||||
return hWndCapturePrv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_Lock
|
||||
*
|
||||
|
@ -378,10 +154,6 @@ static HQUEUE16 QUEUE_CreateMsgQueue( BOOL16 bCreatePerQData )
|
|||
msgQueue->self = hQueue;
|
||||
msgQueue->lockCount = 1;
|
||||
msgQueue->magic = QUEUE_MAGIC;
|
||||
|
||||
/* Create and initialize our per queue data */
|
||||
msgQueue->pQData = bCreatePerQData ? PERQDATA_CreateInstance() : NULL;
|
||||
|
||||
return hQueue;
|
||||
}
|
||||
|
||||
|
@ -410,21 +182,7 @@ void QUEUE_DeleteMsgQueue(void)
|
|||
}
|
||||
|
||||
msgQueue->magic = 0;
|
||||
|
||||
if( hActiveQueue == hQueue ) hActiveQueue = 0;
|
||||
|
||||
HeapLock( GetProcessHeap() ); /* FIXME: a bit overkill */
|
||||
|
||||
/* Release per queue data if present */
|
||||
if ( msgQueue->pQData )
|
||||
{
|
||||
PERQDATA_Release( msgQueue->pQData );
|
||||
msgQueue->pQData = 0;
|
||||
}
|
||||
|
||||
msgQueue->self = 0;
|
||||
|
||||
HeapUnlock( GetProcessHeap() );
|
||||
SetThreadQueue16( 0, 0 );
|
||||
|
||||
/* free up resource used by MESSAGEQUEUE structure */
|
||||
|
|
Loading…
Reference in New Issue