- added a dump of the palette creation flags
[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 "wine/winuser16.h"
11 #include "windows.h"
12 #include "thread.h"
13
14
15   /* Message as stored in the queue (contains the extraInfo field) */
16 typedef struct tagQMSG
17 {
18     MSG32   msg;
19     DWORD   extraInfo;  /* Only in 3.1 */
20     
21     struct tagQMSG *nextMsg;
22     struct tagQMSG *prevMsg;
23 } QMSG;
24
25 typedef struct
26 {
27   LRESULT   lResult;
28   BOOL16    bPending;
29 } QSMCTRL;
30
31 /* Per-queue system windows */
32 typedef struct tagPERQUEUEDATA      
33 {
34   HWND32    hWndCapture;
35   HWND32    hWndFocus;
36   HWND32    hWndActive;
37 } PERQUEUEDATA;
38
39 typedef struct tagMESSAGEQUEUE
40 {
41   HQUEUE16  next;                   /* NNext queue */
42   HQUEUE16  self;                   /* Handle to self (was: reserved) */
43   THDB*     thdb;                   /* Thread owning queue */
44   HANDLE32  hEvent;                 /* Event handle */
45   CRITICAL_SECTION cSection;        /* Queue access critical section */
46
47   DWORD     magic;                  /* magic number should be QUEUE_MAGIC */
48   DWORD     lockCount;              /* reference counter */
49   
50   WORD      flags;                  /* Queue flags */
51   WORD      wWinVersion;            /* Expected Windows version */
52   
53   WORD      msgCount;               /* Number of waiting messages */
54   QMSG*     firstMsg;               /* First message in linked list */
55   QMSG*     lastMsg;                /* Last message in linked list */
56   
57   WORD      wPostQMsg;              /* PostQuitMessage flag */
58   WORD      wExitCode;              /* PostQuitMessage exit code */
59   WORD      wPaintCount;            /* Number of WM_PAINT needed */
60   WORD      wTimerCount;            /* Number of timers for this task */
61
62   WORD      changeBits;             /* Changed wake-up bits */
63   WORD      wakeBits;               /* Queue wake-up bits */
64   WORD      wakeMask;               /* Queue wake-up mask */
65
66   DWORD     GetMessageTimeVal;      /* Value for GetMessageTime */
67   DWORD     GetMessagePosVal;       /* Value for GetMessagePos */
68   DWORD     GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
69   
70   HQUEUE16  InSendMessageHandle;    /* Queue of task that sent a message */
71   HTASK16   hSendingTask;           /* Handle of task that sent a message */
72   HTASK16   hPrevSendingTask;       /* Handle of previous sender */
73   
74   HWND32    hWnd32;                 /* Send message arguments */
75   UINT32    msg32;                  
76   WPARAM32  wParam32;               
77   LPARAM    lParam;                 
78   DWORD     SendMessageReturn;      /* Return value for SendMessage */
79
80   QSMCTRL*  smResultInit;           /* SendMesage result pointers */
81   QSMCTRL*  smResultCurrent;        
82   QSMCTRL*  smResult;               
83   
84   HANDLE16  hCurHook;               /* Current hook */
85   HANDLE16  hooks[WH_NB_HOOKS];     /* Task hooks list */
86
87   HANDLE16  hPerQueue;              /* handle on PERQUEUEDATA structure */
88   
89 } MESSAGEQUEUE;
90
91
92 /* Extra (undocumented) queue wake bits - see "Undoc. Windows" */
93 #define QS_SMRESULT      0x8000  /* Queue has a SendMessage() result */
94 #define QS_SMPARAMSFREE  0x4000  /* SendMessage() parameters are available */
95
96 /* Queue flags */
97 #define QUEUE_SM_WIN32     0x0002  /* Currently sent message is Win32 */
98 #define QUEUE_SM_UNICODE   0x0004  /* Currently sent message is Unicode */
99
100 #define QUEUE_MAGIC        0xD46E80AF
101
102 extern MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue );
103 extern void QUEUE_Unlock( MESSAGEQUEUE *queue );
104 extern void QUEUE_DumpQueue( HQUEUE16 hQueue );
105 extern void QUEUE_WalkQueues(void);
106 extern BOOL32 QUEUE_IsExitingQueue( HQUEUE16 hQueue );
107 extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
108 extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
109 extern void QUEUE_Signal( THDB *thdb );
110 extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit );
111 extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
112 extern void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue );
113 extern void QUEUE_WaitBits( WORD bits );
114 extern void QUEUE_IncPaintCount( HQUEUE16 hQueue );
115 extern void QUEUE_DecPaintCount( HQUEUE16 hQueue );
116 extern void QUEUE_IncTimerCount( HQUEUE16 hQueue );
117 extern void QUEUE_DecTimerCount( HQUEUE16 hQueue );
118 extern BOOL32 QUEUE_CreateSysMsgQueue( );
119 extern BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue );
120 extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue );
121 extern BOOL32 QUEUE_AddMsg( HQUEUE16 hQueue, MSG32 * msg, DWORD extraInfo );
122 extern QMSG* QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND32 hwnd,
123                           int first, int last );
124 extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, QMSG *qmsg );
125 extern void QUEUE_FlushMessages(HQUEUE16);
126 extern void hardware_event( WORD message, WORD wParam, LONG lParam,
127                             int xPos, int yPos, DWORD time, DWORD extraInfo );
128
129 extern HQUEUE16 WINAPI InitThreadInput( WORD unknown, WORD flags );
130
131 #endif  /* __WINE_QUEUE_H */