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