2 * Message queues definitions
4 * Copyright 1993 Alexandre Julliard
17 /* Message as stored in the queue (contains the extraInfo field) */
18 typedef struct tagQMSG
22 DWORD extraInfo; /* Only in 3.1 */
24 struct tagQMSG *nextMsg;
25 struct tagQMSG *prevMsg;
31 #define QMSG_HARDWARE 3
34 /* Per-queue data for the message queue
35 * Note that we currently only store the current values for
36 * Active, Capture and Focus windows currently.
37 * It might be necessary to store a pointer to the system message queue
38 * as well since windows 9x maintains per thread system message queues
40 typedef struct tagPERQUEUEDATA
42 HWND hWndFocus; /* Focus window */
43 HWND hWndActive; /* Active window */
44 HWND hWndCapture; /* Capture window */
45 INT16 nCaptureHT; /* Capture info (hit-test) */
46 ULONG ulRefCount; /* Reference count */
47 CRITICAL_SECTION cSection; /* Critical section for thread safe access */
51 typedef struct tagMESSAGEQUEUE
53 HQUEUE16 self; /* Handle to self (was: reserved) */
54 TEB* teb; /* Thread owning queue */
55 HANDLE server_queue; /* Handle to server-side queue */
56 CRITICAL_SECTION cSection; /* Queue access critical section */
58 DWORD magic; /* magic number should be QUEUE_MAGIC */
59 DWORD lockCount; /* reference counter */
61 QMSG* firstMsg; /* First message in linked list */
62 QMSG* lastMsg; /* Last message in linked list */
64 WORD wPostQMsg; /* PostQuitMessage flag */
65 WORD wExitCode; /* PostQuitMessage exit code */
66 WORD wPaintCount; /* Number of WM_PAINT needed */
68 DWORD GetMessageTimeVal; /* Value for GetMessageTime */
69 DWORD GetMessagePosVal; /* Value for GetMessagePos */
70 DWORD GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
72 HANDLE16 hCurHook; /* Current hook */
73 HANDLE16 hooks[WH_NB_HOOKS]; /* Task hooks list */
75 PERQUEUEDATA *pQData; /* pointer to (shared) PERQUEUEDATA structure */
80 #define QUEUE_MAGIC 0xD46E80AF
82 /* Per queue data management methods */
83 PERQUEUEDATA* PERQDATA_CreateInstance( void );
84 ULONG PERQDATA_Addref( PERQUEUEDATA* pQData );
85 ULONG PERQDATA_Release( PERQUEUEDATA* pQData );
86 HWND PERQDATA_GetFocusWnd( PERQUEUEDATA *pQData );
87 HWND PERQDATA_SetFocusWnd( PERQUEUEDATA *pQData, HWND hWndFocus );
88 HWND PERQDATA_GetActiveWnd( PERQUEUEDATA *pQData );
89 HWND PERQDATA_SetActiveWnd( PERQUEUEDATA *pQData, HWND hWndActive );
90 HWND PERQDATA_GetCaptureWnd( PERQUEUEDATA *pQData );
91 HWND PERQDATA_SetCaptureWnd( PERQUEUEDATA *pQData, HWND hWndCapture );
92 INT16 PERQDATA_GetCaptureInfo( PERQUEUEDATA *pQData );
93 INT16 PERQDATA_SetCaptureInfo( PERQUEUEDATA *pQData, INT16 nCaptureHT );
95 /* Message queue management methods */
96 extern MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue );
97 extern void QUEUE_Unlock( MESSAGEQUEUE *queue );
98 extern void QUEUE_DumpQueue( HQUEUE16 hQueue );
99 extern BOOL QUEUE_IsExitingQueue( HQUEUE16 hQueue );
100 extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
101 extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
102 extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD set, WORD clear );
103 extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
104 extern WORD QUEUE_TestWakeBit( MESSAGEQUEUE *queue, WORD bit );
105 extern int QUEUE_WaitBits( WORD bits, DWORD timeout );
106 extern void QUEUE_IncPaintCount( HQUEUE16 hQueue );
107 extern void QUEUE_DecPaintCount( HQUEUE16 hQueue );
108 extern BOOL QUEUE_CreateSysMsgQueue( int size );
109 extern BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue );
110 extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue );
111 extern BOOL QUEUE_FindMsg( HWND hwnd, UINT first, UINT last, BOOL remove,
112 BOOL sent_only, QMSG *msg );
113 extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, QMSG *qmsg );
114 extern void QUEUE_CleanupWindow( HWND hwnd );
115 extern void hardware_event( UINT message, WPARAM wParam, LPARAM lParam,
116 int xPos, int yPos, DWORD time, DWORD extraInfo );
118 extern HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags );
120 #endif /* __WINE_QUEUE_H */