Moved hardware message queue handling to the server.
[wine] / include / queue.h
1 /*
2  * Message queues definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  */
6
7 #ifndef __WINE_QUEUE_H
8 #define __WINE_QUEUE_H
9
10 #include "windef.h"
11 #include "winbase.h"
12 #include "wingdi.h"
13 #include "winuser.h"
14 #include "thread.h"
15
16
17   /* Message as stored in the queue (contains the extraInfo field) */
18 typedef struct tagQMSG
19 {
20     int   kind;   /* message kind (sent,posted,hardware) */
21     int   type;
22     MSG   msg;
23     DWORD extraInfo;  /* Only in 3.1 */
24     
25     struct tagQMSG *nextMsg;
26     struct tagQMSG *prevMsg;
27 } QMSG;
28
29 #define QMSG_WIN16    0
30 #define QMSG_WIN32A   1
31 #define QMSG_WIN32W   2
32 #define QMSG_HARDWARE 3
33
34
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
40  */
41 typedef struct tagPERQUEUEDATA      
42 {
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 */
49 } PERQUEUEDATA;
50
51 /* Message queue */
52 typedef struct tagMESSAGEQUEUE
53 {
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 */
58
59   DWORD     magic;                  /* magic number should be QUEUE_MAGIC */
60   DWORD     lockCount;              /* reference counter */
61   
62   QMSG*     firstMsg;               /* First message in linked list */
63   QMSG*     lastMsg;                /* Last message in linked list */
64   
65   WORD      wPostQMsg;              /* PostQuitMessage flag */
66   WORD      wExitCode;              /* PostQuitMessage exit code */
67   WORD      wPaintCount;            /* Number of WM_PAINT needed */
68
69   DWORD     GetMessageTimeVal;      /* Value for GetMessageTime */
70   DWORD     GetMessagePosVal;       /* Value for GetMessagePos */
71   DWORD     GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
72
73   HANDLE16  hCurHook;               /* Current hook */
74   HANDLE16  hooks[WH_NB_HOOKS];     /* Task hooks list */
75
76   PERQUEUEDATA *pQData;             /* pointer to (shared) PERQUEUEDATA structure */
77   
78 } MESSAGEQUEUE;
79
80
81 #define QUEUE_MAGIC        0xD46E80AF
82
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 );
95     
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 );
112
113 extern HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags );
114
115 #endif  /* __WINE_QUEUE_H */