:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[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 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 } USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE;
66
67 VOID
68 MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
69                PUSER_SENT_MESSAGE Message);
70 VOID
71 MsqInitializeMessage(PUSER_MESSAGE Message,
72                      LPMSG Msg);
73 PUSER_MESSAGE
74 MsqCreateMessage(LPMSG Msg);
75 VOID
76 MsqDestroyMessage(PUSER_MESSAGE Message);
77 VOID
78 MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue,
79                PUSER_MESSAGE Message);
80 BOOLEAN
81 MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
82                IN BOOLEAN Hardware,
83                IN BOOLEAN Remove,
84                IN HWND Wnd,
85                IN UINT MsgFilterLow,
86                IN UINT MsgFilterHigh,
87                OUT PUSER_MESSAGE* Message);
88 VOID
89 MsqInitializeMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
90 VOID
91 MsqFreeMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
92 PUSER_MESSAGE_QUEUE
93 MsqCreateMessageQueue(VOID);
94 VOID
95 MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
96 PUSER_MESSAGE_QUEUE
97 MsqGetHardwareMessageQueue(VOID);
98 NTSTATUS
99 MsqWaitForNewMessage(PUSER_MESSAGE_QUEUE MessageQueue);
100 NTSTATUS
101 MsqInitializeImpl(VOID);
102 BOOLEAN
103 MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
104 NTSTATUS
105 MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue);
106 VOID
107 MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
108                      PUSER_SENT_MESSAGE_NOTIFY NotifyMessage);
109 VOID
110 MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
111 VOID
112 MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
113 LRESULT STDCALL
114 W32kSendMessage(HWND hWnd,
115                 UINT Msg,
116                 WPARAM wParam,
117                 LPARAM lParam,
118                 BOOL KernelMessage);
119 VOID
120 MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
121 VOID
122 MsqInsertSystemMessage(MSG* Msg);
123
124 #define MAKE_LONG(x, y) ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))
125
126 #endif /* __WIN32K_MSGQUEUE_H */
127
128 /* EOF */