b9a94593b173ccfc35a483e3b189f31f21fc11c1
[reactos.git] / subsys / win32k / include / msgqueue.h
1 #ifndef __WIN32K_MSGQUEUE_H
2 #define __WIN32K_MSGQUEUE_H
3
4 #include <windows.h>
5
6 typedef struct _USER_MESSAGE
7 {
8   LIST_ENTRY ListEntry;
9   MSG Msg;
10 } USER_MESSAGE, *PUSER_MESSAGE;
11
12 struct _USER_MESSAGE_QUEUE;
13
14 typedef struct _USER_SENT_MESSAGE
15 {
16   LIST_ENTRY ListEntry;
17   MSG Msg;
18   PKEVENT CompletionEvent;
19   LRESULT* Result;
20   struct _USER_MESSAGE_QUEUE* CompletionQueue;
21   SENDASYNCPROC CompletionCallback;
22   ULONG_PTR CompletionCallbackContext;
23 } USER_SENT_MESSAGE, *PUSER_SENT_MESSAGE;
24
25 typedef struct _USER_SENT_MESSAGE_NOTIFY
26 {
27   SENDASYNCPROC CompletionCallback;
28   ULONG_PTR CompletionCallbackContext;
29   LRESULT Result;
30   HWND hWnd;
31   UINT Msg;
32   LIST_ENTRY ListEntry;
33 } USER_SENT_MESSAGE_NOTIFY, *PUSER_SENT_MESSAGE_NOTIFY;
34
35 typedef struct _USER_MESSAGE_QUEUE
36 {
37   /* Queue of messages sent to the queue. */
38   LIST_ENTRY SentMessagesListHead;
39   /* Queue of messages posted to the queue. */
40   LIST_ENTRY PostedMessagesListHead;
41   /* Queue of sent-message notifies for the queue. */
42   LIST_ENTRY NotifyMessagesListHead;
43   /* Queue for hardware messages for the queue. */
44   LIST_ENTRY HardwareMessagesListHead;
45   /* Lock for the queue. */
46   FAST_MUTEX Lock;
47   /* True if a WM_QUIT message is pending. */
48   BOOLEAN QuitPosted;
49   /* The quit exit code. */
50   ULONG QuitExitCode;
51   /* Set if there are new messages in any of the queues. */
52   KEVENT NewMessages;  
53   /* FIXME: Unknown. */
54   ULONG QueueStatus;
55   /* Current window with focus (ie. receives keyboard input) for this queue. */
56   HWND FocusWindow;
57   /* True if a window needs painting. */
58   BOOLEAN PaintPosted;
59   /* Count of paints pending. */
60   ULONG PaintCount;
61   /* Current active window for this queue. */
62   HWND ActiveWindow;
63   /* Current capture window for this queue. */
64   HWND CaptureWindow;
65
66   /* queue state tracking */
67   WORD WakeBits;
68   WORD WakeMask;
69   WORD ChangedBits;
70   WORD ChangedMask;
71
72 } USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE;
73
74 VOID FASTCALL
75 MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
76                PUSER_SENT_MESSAGE Message);
77 VOID FASTCALL
78 MsqInitializeMessage(PUSER_MESSAGE Message,
79                      LPMSG Msg);
80 PUSER_MESSAGE FASTCALL
81 MsqCreateMessage(LPMSG Msg);
82 VOID FASTCALL
83 MsqDestroyMessage(PUSER_MESSAGE Message);
84 VOID FASTCALL
85 MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue,
86                PUSER_MESSAGE Message);
87 VOID FASTCALL
88 MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode);
89 BOOLEAN STDCALL
90 MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
91                IN BOOLEAN Hardware,
92                IN BOOLEAN Remove,
93                IN HWND Wnd,
94                IN UINT MsgFilterLow,
95                IN UINT MsgFilterHigh,
96                OUT PUSER_MESSAGE* Message);
97 VOID FASTCALL
98 MsqInitializeMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
99 VOID FASTCALL
100 MsqFreeMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
101 PUSER_MESSAGE_QUEUE FASTCALL
102 MsqCreateMessageQueue(VOID);
103 VOID FASTCALL
104 MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
105 PUSER_MESSAGE_QUEUE FASTCALL
106 MsqGetHardwareMessageQueue(VOID);
107 NTSTATUS FASTCALL
108 MsqWaitForNewMessage(PUSER_MESSAGE_QUEUE MessageQueue);
109 NTSTATUS FASTCALL
110 MsqInitializeImpl(VOID);
111 BOOLEAN FASTCALL
112 MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
113 NTSTATUS FASTCALL
114 MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue);
115 VOID FASTCALL
116 MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
117                      PUSER_SENT_MESSAGE_NOTIFY NotifyMessage);
118 VOID FASTCALL
119 MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
120 VOID FASTCALL
121 MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
122 LRESULT STDCALL
123 IntSendMessage(HWND hWnd,
124                 UINT Msg,
125                 WPARAM wParam,
126                 LPARAM lParam,
127                 BOOL KernelMessage);
128 VOID STDCALL
129 MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
130 VOID FASTCALL
131 MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg);
132
133 inline BOOL MsqIsSignaled( PUSER_MESSAGE_QUEUE queue );
134 inline VOID MsqSetQueueBits( PUSER_MESSAGE_QUEUE queue, WORD bits );
135 inline VOID MsqClearQueueBits( PUSER_MESSAGE_QUEUE queue, WORD bits );
136
137 #define MAKE_LONG(x, y) ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))
138
139 #endif /* __WIN32K_MSGQUEUE_H */
140
141 /* EOF */