Moves more stuff from windows.h.
[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
13   /* Message as stored in the queue (contains the extraInfo field) */
14 typedef struct tagQMSG
15 {
16     DWORD   extraInfo;  /* Only in 3.1 */
17     MSG16   msg;
18 } QMSG;
19
20 typedef struct
21 {
22   LRESULT   lResult;
23   BOOL16    bPending;
24 } QSMCTRL;
25
26 #pragma pack(1)
27
28 typedef struct tagMESSAGEQUEUE
29 {
30   HQUEUE16  next;                   /* 00 Next queue */
31   HTASK16   hTask;                  /* 02 hTask owning the queue */
32   WORD      msgSize;                /* 04 Size of messages in the queue */
33   WORD      msgCount;               /* 06 Number of waiting messages */
34   WORD      nextMessage;            /* 08 Next message to be retrieved */
35   WORD      nextFreeMessage;        /* 0a Next available slot in the queue */
36   WORD      queueSize;              /* 0c Size of the queue */
37   DWORD     GetMessageTimeVal WINE_PACKED;  /* 0e Value for GetMessageTime */
38   DWORD     GetMessagePosVal WINE_PACKED;   /* 12 Value for GetMessagePos */
39   HQUEUE16  self;                   /* 16 Handle to self (was: reserved) */
40   DWORD     GetMessageExtraInfoVal; /* 18 Value for GetMessageExtraInfo */
41   WORD      wParamHigh;             /* 1c High word of wParam (was: reserved)*/
42   LPARAM    lParam WINE_PACKED;     /* 1e Next 4 values set by SendMessage */
43   WPARAM16  wParam;                 /* 22 */
44   UINT16    msg;                    /* 24 */
45   HWND16    hWnd;                   /* 26 */
46   DWORD     SendMessageReturn;      /* 28 Return value for SendMessage */
47   WORD      wPostQMsg;              /* 2c PostQuitMessage flag */
48   WORD      wExitCode;              /* 2e PostQuitMessage exit code */
49   WORD      flags;                  /* 30 Queue flags */
50   QSMCTRL*  smResultInit;           /* 32 1st LRESULT ptr - was: reserved */
51   WORD      wWinVersion;            /* 36 Expected Windows version */
52   HQUEUE16  InSendMessageHandle;    /* 38 Queue of task that sent a message */
53   HTASK16   hSendingTask;           /* 3a Handle of task that sent a message */
54   HTASK16   hPrevSendingTask;       /* 3c Handle of previous sender */
55   WORD      wPaintCount;            /* 3e Number of WM_PAINT needed */
56   WORD      wTimerCount;            /* 40 Number of timers for this task */
57   WORD      changeBits;             /* 42 Changed wake-up bits */
58   WORD      wakeBits;               /* 44 Queue wake-up bits */
59   WORD      wakeMask;               /* 46 Queue wake-up mask */
60   QSMCTRL*  smResultCurrent;        /* 48 ptrs to SendMessage() LRESULT - point to */
61   WORD      SendMsgReturnPtr[1];    /*    values on stack */
62   HANDLE16  hCurHook;               /* 4e Current hook */
63   HANDLE16  hooks[WH_NB_HOOKS];     /* 50 Task hooks list */
64   QSMCTRL*  smResult;               /* 6c 3rd LRESULT ptr - was: reserved */
65   QMSG      messages[1];            /* 70 Queue messages */
66 } MESSAGEQUEUE;
67
68 #pragma pack(4)
69
70 /* Extra (undocumented) queue wake bits - see "Undoc. Windows" */
71 #define QS_SMRESULT      0x8000  /* Queue has a SendMessage() result */
72 #define QS_SMPARAMSFREE  0x4000  /* SendMessage() parameters are available */
73
74 /* Queue flags */
75 #define QUEUE_SM_WIN32     0x0002  /* Currently sent message is Win32 */
76 #define QUEUE_SM_UNICODE   0x0004  /* Currently sent message is Unicode */
77
78 extern void QUEUE_DumpQueue( HQUEUE16 hQueue );
79 extern void QUEUE_WalkQueues(void);
80 extern BOOL32 QUEUE_IsExitingQueue( HQUEUE16 hQueue );
81 extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
82 extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
83 extern void QUEUE_Signal( HTASK16 hTask );
84 extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit );
85 extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
86 extern void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue );
87 extern void QUEUE_WaitBits( WORD bits );
88 extern void QUEUE_IncPaintCount( HQUEUE16 hQueue );
89 extern void QUEUE_DecPaintCount( HQUEUE16 hQueue );
90 extern void QUEUE_IncTimerCount( HQUEUE16 hQueue );
91 extern void QUEUE_DecTimerCount( HQUEUE16 hQueue );
92 extern BOOL32 QUEUE_CreateSysMsgQueue( int size );
93 extern BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue );
94 extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue );
95 extern BOOL32 QUEUE_AddMsg( HQUEUE16 hQueue, MSG16 * msg, DWORD extraInfo );
96 extern int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND32 hwnd,
97                           int first, int last );
98 extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos );
99 extern void QUEUE_FlushMessages(HQUEUE16);
100 extern void hardware_event( WORD message, WORD wParam, LONG lParam,
101                             int xPos, int yPos, DWORD time, DWORD extraInfo );
102
103 extern HQUEUE16 WINAPI InitThreadInput( WORD unknown, WORD flags );
104
105 #endif  /* __WINE_QUEUE_H */