7be49ed298246c35490017598d00346e54f43eb9
[reactos.git] / rostests / winetests / user32 / msg.c
1 /*
2 * Unit tests for window message handling
3 *
4 * Copyright 1999 Ove Kaaven
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2004, 2005 Dmitry Timoshkov
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23 #define _WIN32_WINNT 0x0501 /* For WM_CHANGEUISTATE,QS_RAWINPUT */
24
25 #include <assert.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
33 #include "winnls.h"
34
35 #include "wine/test.h"
36
37 #define MDI_FIRST_CHILD_ID 2004
38
39 /* undocumented SWP flags - from SDK 3.1 */
40 #define SWP_NOCLIENTSIZE 0x0800
41 #define SWP_NOCLIENTMOVE 0x1000
42 #define SWP_STATECHANGED 0x8000
43
44 #define SW_NORMALNA 0xCC /* undoc. flag in MinMaximize */
45
46 #ifndef WM_KEYF1
47 #define WM_KEYF1 0x004d
48 #endif
49
50 #ifndef WM_SYSTIMER
51 #define WM_SYSTIMER 0x0118
52 #endif
53
54 #define WND_PARENT_ID 1
55 #define WND_POPUP_ID 2
56 #define WND_CHILD_ID 3
57
58 #ifndef WM_LBTRACKPOINT
59 #define WM_LBTRACKPOINT 0x0131
60 #endif
61
62 /* encoded DRAWITEMSTRUCT into an LPARAM */
63 typedef struct
64 {
65 union
66 {
67 struct
68 {
69 UINT type : 4; /* ODT_* flags */
70 UINT ctl_id : 4; /* Control ID */
71 UINT item_id : 4; /* Menu item ID */
72 UINT action : 4; /* ODA_* flags */
73 UINT state : 16; /* ODS_* flags */
74 } item;
75 LPARAM lp;
76 } u;
77 } DRAW_ITEM_STRUCT;
78
79 static BOOL test_DestroyWindow_flag;
80 static HWINEVENTHOOK hEvent_hook;
81 static HHOOK hCBT_hook;
82 static DWORD cbt_hook_thread_id;
83
84 static const WCHAR testWindowClassW[] =
85 { 'T','e','s','t','W','i','n','d','o','w','C','l','a','s','s','W',0 };
86
87 /*
88 FIXME: add tests for these
89 Window Edge Styles (Win31/Win95/98 look), in order of precedence:
90 WS_EX_DLGMODALFRAME: double border, WS_CAPTION allowed
91 WS_THICKFRAME: thick border
92 WS_DLGFRAME: double border, WS_CAPTION not allowed (but possibly shown anyway)
93 WS_BORDER (default for overlapped windows): single black border
94 none (default for child (and popup?) windows): no border
95 */
96
97 typedef enum {
98 sent=0x1,
99 posted=0x2,
100 parent=0x4,
101 wparam=0x8,
102 lparam=0x10,
103 defwinproc=0x20,
104 beginpaint=0x40,
105 optional=0x80,
106 hook=0x100,
107 winevent_hook=0x200
108 } msg_flags_t;
109
110 struct message {
111 UINT message; /* the WM_* code */
112 msg_flags_t flags; /* message props */
113 WPARAM wParam; /* expected value of wParam */
114 LPARAM lParam; /* expected value of lParam */
115 WPARAM wp_mask; /* mask for wParam checks */
116 LPARAM lp_mask; /* mask for lParam checks */
117 };
118
119 struct recvd_message {
120 UINT message; /* the WM_* code */
121 msg_flags_t flags; /* message props */
122 HWND hwnd; /* window that received the message */
123 WPARAM wParam; /* expected value of wParam */
124 LPARAM lParam; /* expected value of lParam */
125 int line; /* source line where logged */
126 const char *descr; /* description for trace output */
127 char output[512]; /* trace output */
128 };
129
130 /* Empty message sequence */
131 static const struct message WmEmptySeq[] =
132 {
133 { 0 }
134 };
135 /* CreateWindow (for overlapped window, not initially visible) (16/32) */
136 static const struct message WmCreateOverlappedSeq[] = {
137 { HCBT_CREATEWND, hook },
138 { WM_GETMINMAXINFO, sent },
139 { WM_NCCREATE, sent },
140 { WM_NCCALCSIZE, sent|wparam, 0 },
141 { 0x0093, sent|defwinproc|optional },
142 { 0x0094, sent|defwinproc|optional },
143 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
144 { WM_CREATE, sent },
145 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
146 { 0 }
147 };
148 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
149 * for a not visible overlapped window.
150 */
151 static const struct message WmSWP_ShowOverlappedSeq[] = {
152 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
153 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
154 { WM_NCPAINT, sent|wparam|optional, 1 },
155 { WM_GETTEXT, sent|defwinproc|optional },
156 { WM_ERASEBKGND, sent|optional },
157 { HCBT_ACTIVATE, hook },
158 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
159 { WM_NOTIFYFORMAT, sent|optional },
160 { WM_QUERYUISTATE, sent|optional },
161 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
162 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* Win9x: SWP_NOSENDCHANGING */
163 { WM_ACTIVATEAPP, sent|wparam, 1 },
164 { WM_NCACTIVATE, sent },
165 { WM_GETTEXT, sent|defwinproc|optional },
166 { WM_ACTIVATE, sent|wparam, 1 },
167 { HCBT_SETFOCUS, hook },
168 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
169 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
170 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
171 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
172 { WM_GETTEXT, sent|optional },
173 { WM_NCPAINT, sent|wparam|optional, 1 },
174 { WM_GETTEXT, sent|defwinproc|optional },
175 { WM_ERASEBKGND, sent|optional },
176 /* Win9x adds SWP_NOZORDER below */
177 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
178 { WM_GETTEXT, sent|optional },
179 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
180 { WM_NCPAINT, sent|wparam|optional, 1 },
181 { WM_ERASEBKGND, sent|optional },
182 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
183 { WM_SYNCPAINT, sent|optional },
184 { WM_GETTITLEBARINFOEX, sent|optional },
185 { WM_PAINT, sent|optional },
186 { WM_NCPAINT, sent|beginpaint|optional },
187 { WM_GETTEXT, sent|defwinproc|optional },
188 { WM_ERASEBKGND, sent|beginpaint|optional },
189 { 0 }
190 };
191 /* SetWindowPos(SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE)
192 * for a visible overlapped window.
193 */
194 static const struct message WmSWP_HideOverlappedSeq[] = {
195 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE },
196 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
197 { HCBT_ACTIVATE, hook|optional },
198 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
199 { WM_ACTIVATEAPP, sent|wparam|optional, 1 },
200 { WM_NCACTIVATE, sent|optional },
201 { WM_ACTIVATE, sent|optional },
202 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
203 { 0 }
204 };
205
206 /* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE)
207 * for a visible overlapped window.
208 */
209 static const struct message WmSWP_ResizeSeq[] = {
210 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE },
211 { WM_GETMINMAXINFO, sent|defwinproc },
212 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
213 { WM_NCPAINT, sent|optional },
214 { WM_GETTEXT, sent|defwinproc|optional },
215 { WM_ERASEBKGND, sent|optional },
216 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
217 { WM_SIZE, sent|defwinproc|optional },
218 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
219 { WM_NCPAINT, sent|optional },
220 { WM_GETTEXT, sent|defwinproc|optional },
221 { WM_ERASEBKGND, sent|optional },
222 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
223 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
224 { 0 }
225 };
226
227 /* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE)
228 * for a visible popup window.
229 */
230 static const struct message WmSWP_ResizePopupSeq[] = {
231 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE },
232 { WM_GETMINMAXINFO, sent|defwinproc|optional }, /* Win9x */
233 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
234 { WM_NCPAINT, sent|optional },
235 { WM_GETTEXT, sent|defwinproc|optional },
236 { WM_ERASEBKGND, sent|optional },
237 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
238 { WM_SIZE, sent|defwinproc|wparam|optional, SIZE_RESTORED },
239 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
240 { WM_NCPAINT, sent|optional },
241 { WM_GETTEXT, sent|defwinproc|optional },
242 { WM_ERASEBKGND, sent|optional },
243 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
244 { 0 }
245 };
246
247 /* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE)
248 * for a visible overlapped window.
249 */
250 static const struct message WmSWP_MoveSeq[] = {
251 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_NOSIZE },
252 { WM_NCPAINT, sent|optional },
253 { WM_GETTEXT, sent|defwinproc|optional },
254 { WM_ERASEBKGND, sent|optional },
255 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCLIENTSIZE },
256 { WM_MOVE, sent|defwinproc|wparam, 0 },
257 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
258 { 0 }
259 };
260 /* Resize with SetWindowPos(SWP_NOZORDER)
261 * for a visible overlapped window
262 * SWP_NOZORDER is stripped by the logging code
263 */
264 static const struct message WmSWP_ResizeNoZOrder[] = {
265 { WM_WINDOWPOSCHANGING, sent|wparam, /*SWP_NOZORDER|*/SWP_NOACTIVATE },
266 { WM_GETMINMAXINFO, sent|defwinproc },
267 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
268 { WM_NCPAINT, sent|optional },
269 { WM_GETTEXT, sent|defwinproc|optional },
270 { WM_ERASEBKGND, sent|optional },
271 { WM_WINDOWPOSCHANGED, sent|wparam|optional, /*SWP_NOZORDER|*/SWP_NOACTIVATE, 0,
272 SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_NOSIZE|SWP_NOCLIENTSIZE },
273 { WM_MOVE, sent|defwinproc|optional },
274 { WM_SIZE, sent|defwinproc|optional },
275 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* Win9x doesn't send it */
276 { WM_NCPAINT, sent|optional }, /* Win9x doesn't send it */
277 { WM_GETTEXT, sent|defwinproc|optional }, /* Win9x doesn't send it */
278 { WM_ERASEBKGND, sent|optional }, /* Win9x doesn't send it */
279 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
280 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
281 { 0 }
282 };
283
284 /* Switch visible mdi children */
285 static const struct message WmSwitchChild[] = {
286 /* Switch MDI child */
287 { WM_MDIACTIVATE, sent },/* in the MDI client */
288 { WM_WINDOWPOSCHANGING, sent|wparam,SWP_NOSIZE|SWP_NOMOVE },/* in the 1st MDI child */
289 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
290 { WM_CHILDACTIVATE, sent },/* in the 1st MDI child */
291 /* Deactivate 2nd MDI child */
292 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 2nd MDI child */
293 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 2nd MDI child */
294 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
295 /* Preparing for maximize and maximaze the 1st MDI child */
296 { WM_GETMINMAXINFO, sent|defwinproc }, /* in the 1st MDI child */
297 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_STATECHANGED }, /* in the 1st MDI child */
298 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 }, /* in the 1st MDI child */
299 { WM_CHILDACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
300 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED }, /* in the 1st MDI child */
301 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED }, /* in the 1st MDI child */
302 /* Lock redraw 2nd MDI child */
303 { WM_SETREDRAW, sent|wparam|defwinproc, 0 }, /* in the 2nd MDI child */
304 { HCBT_MINMAX, hook|lparam, 0, SW_NORMALNA },
305 /* Restore 2nd MDI child */
306 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },/* in the 2nd MDI child */
307 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },/* in the 2nd MDI child */
308 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 }, /* in the 2nd MDI child */
309 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED }, /* in the 2nd MDI child */
310 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED }, /* in the 2nd MDI child */
311 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in the 2nd MDI child */
312 /* Redraw 2nd MDI child */
313 { WM_SETREDRAW, sent|wparam|defwinproc, 1 },/* in the 2nd MDI child */
314 /* Redraw MDI frame */
315 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE },/* in MDI frame */
316 { WM_NCCALCSIZE, sent|wparam, 1 },/* in MDI frame */
317 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE}, /* in MDI frame */
318 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in MDI frame */
319 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in the 1st MDI child */
320 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, /* in the 1st MDI child */
321 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 }, /* in the 1st MDI child */
322 { HCBT_SETFOCUS, hook },
323 { WM_KILLFOCUS, sent|defwinproc }, /* in the 2nd MDI child */
324 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 },/* in the 1st MDI child */
325 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
326 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
327 { WM_SETFOCUS, sent },/* in the MDI client */
328 { HCBT_SETFOCUS, hook },
329 { WM_KILLFOCUS, sent },/* in the MDI client */
330 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
331 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, /* in the 1st MDI child */
332 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
333 { WM_SETFOCUS, sent|defwinproc }, /* in the 1st MDI child */
334 { WM_MDIACTIVATE, sent|defwinproc },/* in the 1st MDI child */
335 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE }, /* in the 1st MDI child */
336 { 0 }
337 };
338
339 /* Switch visible not maximized mdi children */
340 static const struct message WmSwitchNotMaximizedChild[] = {
341 /* Switch not maximized MDI child */
342 { WM_MDIACTIVATE, sent },/* in the MDI client */
343 { WM_WINDOWPOSCHANGING, sent|wparam,SWP_NOSIZE|SWP_NOMOVE },/* in the 2nd MDI child */
344 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
345 { WM_CHILDACTIVATE, sent },/* in the 2nd MDI child */
346 /* Deactivate 1st MDI child */
347 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
348 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
349 /* Activate 2nd MDI child */
350 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE}, /* in the 2nd MDI child */
351 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 }, /* in the 2nd MDI child */
352 { HCBT_SETFOCUS, hook }, /* in the 1st MDI child */
353 { WM_KILLFOCUS, sent|defwinproc }, /* in the 1st MDI child */
354 { WM_IME_SETCONTEXT, sent|defwinproc|optional }, /* in the 1st MDI child */
355 { WM_IME_SETCONTEXT, sent|optional }, /* in the MDI client */
356 { WM_SETFOCUS, sent, 0 }, /* in the MDI client */
357 { HCBT_SETFOCUS, hook },
358 { WM_KILLFOCUS, sent }, /* in the MDI client */
359 { WM_IME_SETCONTEXT, sent|optional }, /* in the MDI client */
360 { WM_IME_SETCONTEXT, sent|defwinproc|optional }, /* in the 1st MDI child */
361 { WM_SETFOCUS, sent|defwinproc }, /* in the 2nd MDI child */
362 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 2nd MDI child */
363 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE}, /* in the 2nd MDI child */
364 { 0 }
365 };
366
367
368 /* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|
369 SWP_NOZORDER|SWP_FRAMECHANGED)
370 * for a visible overlapped window with WS_CLIPCHILDREN style set.
371 */
372 static const struct message WmSWP_FrameChanged_clip[] = {
373 { WM_WINDOWPOSCHANGING, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED },
374 { WM_NCCALCSIZE, sent|wparam|parent, 1 },
375 { WM_NCPAINT, sent|parent|optional }, /* wparam != 1 */
376 { WM_GETTEXT, sent|parent|defwinproc|optional },
377 { WM_ERASEBKGND, sent|parent|optional }, /* FIXME: remove optional once Wine is fixed */
378 { WM_NCPAINT, sent }, /* wparam != 1 */
379 { WM_ERASEBKGND, sent },
380 { WM_WINDOWPOSCHANGED, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
381 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
382 { WM_PAINT, sent },
383 { 0 }
384 };
385 /* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_DEFERERASE|SWP_NOACTIVATE|
386 SWP_NOZORDER|SWP_FRAMECHANGED)
387 * for a visible overlapped window.
388 */
389 static const struct message WmSWP_FrameChangedDeferErase[] = {
390 { WM_WINDOWPOSCHANGING, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_DEFERERASE|SWP_NOACTIVATE|SWP_FRAMECHANGED },
391 { WM_NCCALCSIZE, sent|wparam|parent, 1 },
392 { WM_WINDOWPOSCHANGED, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_DEFERERASE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
393 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
394 { WM_PAINT, sent|parent|optional },
395 { WM_NCPAINT, sent|beginpaint|parent|optional }, /* wparam != 1 */
396 { WM_GETTEXT, sent|beginpaint|parent|defwinproc|optional },
397 { WM_PAINT, sent },
398 { WM_NCPAINT, sent|beginpaint }, /* wparam != 1 */
399 { WM_ERASEBKGND, sent|beginpaint|optional },
400 { 0 }
401 };
402
403 /* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|
404 SWP_NOZORDER|SWP_FRAMECHANGED)
405 * for a visible overlapped window without WS_CLIPCHILDREN style set.
406 */
407 static const struct message WmSWP_FrameChanged_noclip[] = {
408 { WM_WINDOWPOSCHANGING, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED },
409 { WM_NCCALCSIZE, sent|wparam|parent, 1 },
410 { WM_NCPAINT, sent|parent|optional }, /* wparam != 1 */
411 { WM_GETTEXT, sent|parent|defwinproc|optional },
412 { WM_ERASEBKGND, sent|parent|optional },
413 { WM_WINDOWPOSCHANGED, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
414 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
415 { WM_PAINT, sent },
416 { WM_NCPAINT, sent|beginpaint }, /* wparam != 1 */
417 { WM_ERASEBKGND, sent|beginpaint|optional },
418 { 0 }
419 };
420
421 /* ShowWindow(SW_SHOW) for a not visible overlapped window */
422 static const struct message WmShowOverlappedSeq[] = {
423 { WM_SHOWWINDOW, sent|wparam, 1 },
424 { WM_NCPAINT, sent|wparam|optional, 1 },
425 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
426 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
427 { WM_NCPAINT, sent|wparam|optional, 1 },
428 { WM_GETTEXT, sent|defwinproc|optional },
429 { WM_ERASEBKGND, sent|optional },
430 { HCBT_ACTIVATE, hook },
431 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
432 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
433 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
434 { WM_NCPAINT, sent|wparam|optional, 1 },
435 { WM_ACTIVATEAPP, sent|wparam, 1 },
436 { WM_NCACTIVATE, sent|wparam, 1 },
437 { WM_GETTEXT, sent|defwinproc|optional },
438 { WM_ACTIVATE, sent|wparam, 1 },
439 { HCBT_SETFOCUS, hook },
440 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
441 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
442 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
443 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
444 { WM_GETTEXT, sent|optional },
445 { WM_NCPAINT, sent|wparam|optional, 1 },
446 { WM_GETTEXT, sent|defwinproc|optional },
447 { WM_ERASEBKGND, sent|optional },
448 /* Win9x adds SWP_NOZORDER below */
449 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
450 { WM_NCCALCSIZE, sent|optional },
451 { WM_GETTEXT, sent|optional },
452 { WM_NCPAINT, sent|optional },
453 { WM_ERASEBKGND, sent|optional },
454 { WM_SYNCPAINT, sent|optional },
455 #if 0 /* CreateWindow/ShowWindow(SW_SHOW) also generates WM_SIZE/WM_MOVE
456 * messages. Does that mean that CreateWindow doesn't set initial
457 * window dimensions for overlapped windows?
458 */
459 { WM_SIZE, sent },
460 { WM_MOVE, sent },
461 #endif
462 { WM_PAINT, sent|optional },
463 { WM_NCPAINT, sent|beginpaint|optional },
464 { 0 }
465 };
466 /* ShowWindow(SW_SHOWMAXIMIZED) for a not visible overlapped window */
467 static const struct message WmShowMaxOverlappedSeq[] = {
468 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
469 { WM_GETMINMAXINFO, sent },
470 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
471 { WM_GETMINMAXINFO, sent|defwinproc },
472 { WM_NCCALCSIZE, sent|wparam, TRUE },
473 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
474 { HCBT_ACTIVATE, hook },
475 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
476 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
477 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
478 { WM_ACTIVATEAPP, sent|wparam, 1 },
479 { WM_NCACTIVATE, sent|wparam, 1 },
480 { WM_GETTEXT, sent|defwinproc|optional },
481 { WM_ACTIVATE, sent|wparam, 1 },
482 { HCBT_SETFOCUS, hook },
483 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
484 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
485 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
486 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
487 { WM_GETTEXT, sent|optional },
488 { WM_NCPAINT, sent|wparam|optional, 1 },
489 { WM_GETTEXT, sent|defwinproc|optional },
490 { WM_ERASEBKGND, sent|optional },
491 /* Win9x adds SWP_NOZORDER below */
492 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
493 { WM_MOVE, sent|defwinproc },
494 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
495 { WM_GETTEXT, sent|optional },
496 { WM_NCCALCSIZE, sent|optional },
497 { WM_NCPAINT, sent|optional },
498 { WM_ERASEBKGND, sent|optional },
499 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
500 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
501 { WM_SYNCPAINT, sent|optional },
502 { WM_GETTITLEBARINFOEX, sent|optional },
503 { WM_PAINT, sent|optional },
504 { WM_NCPAINT, sent|beginpaint|optional },
505 { WM_ERASEBKGND, sent|beginpaint|optional },
506 { 0 }
507 };
508 /* ShowWindow(SW_RESTORE) for a not visible maximized overlapped window */
509 static const struct message WmShowRestoreMaxOverlappedSeq[] = {
510 { HCBT_MINMAX, hook|lparam, 0, SW_RESTORE },
511 { WM_GETTEXT, sent|optional },
512 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
513 { WM_GETMINMAXINFO, sent|defwinproc },
514 { WM_NCCALCSIZE, sent|wparam, TRUE },
515 { WM_NCPAINT, sent|optional },
516 { WM_GETTEXT, sent|defwinproc|optional },
517 { WM_ERASEBKGND, sent|optional },
518 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED, 0, SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_NOSIZE|SWP_NOMOVE },
519 { WM_MOVE, sent|defwinproc|optional },
520 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
521 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
522 { WM_NCPAINT, sent|optional },
523 { WM_ERASEBKGND, sent|optional },
524 { WM_PAINT, sent|optional },
525 { WM_GETTITLEBARINFOEX, sent|optional },
526 { WM_NCPAINT, sent|beginpaint|optional },
527 { WM_ERASEBKGND, sent|beginpaint|optional },
528 { 0 }
529 };
530 /* ShowWindow(SW_RESTORE) for a not visible minimized overlapped window */
531 static const struct message WmShowRestoreMinOverlappedSeq[] = {
532 { HCBT_MINMAX, hook|lparam, 0, SW_RESTORE },
533 { WM_QUERYOPEN, sent|optional },
534 { WM_GETTEXT, sent|optional },
535 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED|SWP_NOCOPYBITS },
536 { WM_GETMINMAXINFO, sent|defwinproc },
537 { WM_NCCALCSIZE, sent|wparam, TRUE },
538 { HCBT_ACTIVATE, hook },
539 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
540 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
541 { WM_ACTIVATEAPP, sent|wparam, 1 },
542 { WM_NCACTIVATE, sent|wparam, 1 },
543 { WM_GETTEXT, sent|defwinproc|optional },
544 { WM_ACTIVATE, sent|wparam, 1 },
545 { HCBT_SETFOCUS, hook },
546 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
547 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
548 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
549 { WM_GETTEXT, sent|optional },
550 { WM_NCPAINT, sent|wparam|optional, 1 },
551 { WM_GETTEXT, sent|defwinproc|optional },
552 { WM_ERASEBKGND, sent },
553 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_STATECHANGED|SWP_FRAMECHANGED|SWP_NOCOPYBITS },
554 { WM_MOVE, sent|defwinproc },
555 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
556 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
557 { WM_NCPAINT, sent|wparam|optional, 1 },
558 { WM_ERASEBKGND, sent|optional },
559 { WM_ACTIVATE, sent|wparam, 1 },
560 { WM_GETTEXT, sent|optional },
561 { WM_PAINT, sent|optional },
562 { WM_GETTITLEBARINFOEX, sent|optional },
563 { WM_NCPAINT, sent|beginpaint|optional },
564 { WM_ERASEBKGND, sent|beginpaint|optional },
565 { 0 }
566 };
567 /* ShowWindow(SW_SHOWMINIMIZED) for a not visible overlapped window */
568 static const struct message WmShowMinOverlappedSeq[] = {
569 { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
570 { HCBT_SETFOCUS, hook },
571 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
572 { WM_KILLFOCUS, sent },
573 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
574 { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
575 { WM_GETTEXT, sent|optional },
576 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
577 { WM_GETMINMAXINFO, sent|defwinproc },
578 { WM_NCCALCSIZE, sent|wparam, TRUE },
579 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
580 { WM_NCPAINT, sent|optional },
581 { WM_GETTEXT, sent|defwinproc|optional },
582 { WM_WINDOWPOSCHANGED, sent },
583 { WM_MOVE, sent|defwinproc },
584 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
585 { WM_NCCALCSIZE, sent|optional },
586 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
587 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
588 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
589 { WM_NCACTIVATE, sent|wparam, 0 },
590 { WM_GETTEXT, sent|defwinproc|optional },
591 { WM_ACTIVATE, sent },
592 { WM_ACTIVATEAPP, sent|wparam, 0 },
593
594 /* Vista sometimes restores the window right away... */
595 { WM_SYSCOMMAND, sent|optional|wparam, SC_RESTORE },
596 { HCBT_SYSCOMMAND, hook|optional|wparam, SC_RESTORE },
597 { HCBT_MINMAX, hook|optional|lparam, 0, SW_RESTORE },
598 { WM_QUERYOPEN, sent|optional },
599 { WM_WINDOWPOSCHANGING, sent|optional|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
600 { WM_GETMINMAXINFO, sent|optional|defwinproc },
601 { WM_NCCALCSIZE, sent|optional|wparam, TRUE },
602 { HCBT_ACTIVATE, hook|optional },
603 { WM_ACTIVATEAPP, sent|optional|wparam, 1 },
604 { WM_NCACTIVATE, sent|optional },
605 { WM_GETTEXT, sent|optional },
606 { WM_ACTIVATE, sent|optional|wparam, 1 },
607 { HCBT_SETFOCUS, hook|optional },
608 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
609 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
610 { WM_SETFOCUS, sent|optional },
611 { WM_NCPAINT, sent|optional },
612 { WM_GETTEXT, sent|defwinproc|optional },
613 { WM_ERASEBKGND, sent|optional },
614 { WM_WINDOWPOSCHANGED, sent|optional|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
615 { WM_MOVE, sent|defwinproc|optional },
616 { WM_SIZE, sent|defwinproc|optional|wparam, SIZE_RESTORED },
617 { WM_ACTIVATE, sent|optional|wparam, 1 },
618 { WM_SYSCOMMAND, sent|optional|wparam, SC_RESTORE },
619 { HCBT_SYSCOMMAND, hook|optional|wparam, SC_RESTORE },
620
621 { WM_PAINT, sent|optional },
622 { WM_NCPAINT, sent|beginpaint|optional },
623 { WM_ERASEBKGND, sent|beginpaint|optional },
624 { 0 }
625 };
626 /* ShowWindow(SW_HIDE) for a visible overlapped window */
627 static const struct message WmHideOverlappedSeq[] = {
628 { WM_SHOWWINDOW, sent|wparam, 0 },
629 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE },
630 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
631 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
632 { WM_SIZE, sent|optional }, /* XP doesn't send it */
633 { WM_MOVE, sent|optional }, /* XP doesn't send it */
634 { WM_NCACTIVATE, sent|wparam|optional, 0 },
635 { WM_ACTIVATE, sent|wparam|optional, 0 },
636 { WM_ACTIVATEAPP, sent|wparam|optional, 0 },
637 { HCBT_SETFOCUS, hook|optional },
638 { WM_KILLFOCUS, sent|wparam, 0 },
639 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
640 { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
641 { 0 }
642 };
643 /* DestroyWindow for a visible overlapped window */
644 static const struct message WmDestroyOverlappedSeq[] = {
645 { HCBT_DESTROYWND, hook },
646 { 0x0090, sent|optional },
647 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
648 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
649 { 0x0090, sent|optional },
650 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
651 { WM_NCACTIVATE, sent|optional|wparam, 0 },
652 { WM_ACTIVATE, sent|optional },
653 { WM_ACTIVATEAPP, sent|optional|wparam, 0 },
654 { WM_KILLFOCUS, sent|optional|wparam, 0 },
655 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
656 { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
657 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
658 { WM_DESTROY, sent },
659 { WM_NCDESTROY, sent },
660 { 0 }
661 };
662 /* CreateWindow(WS_MAXIMIZE|WS_VISIBLE) for popup window */
663 static const struct message WmCreateMaxPopupSeq[] = {
664 { HCBT_CREATEWND, hook },
665 { WM_NCCREATE, sent },
666 { WM_NCCALCSIZE, sent|wparam, 0 },
667 { WM_CREATE, sent },
668 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
669 { WM_SIZE, sent|wparam, SIZE_RESTORED },
670 { WM_MOVE, sent },
671 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
672 { WM_GETMINMAXINFO, sent },
673 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },
674 { WM_NCCALCSIZE, sent|wparam, TRUE },
675 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_STATECHANGED },
676 { WM_MOVE, sent|defwinproc },
677 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
678 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
679 { WM_SHOWWINDOW, sent|wparam, 1 },
680 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
681 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
682 { HCBT_ACTIVATE, hook },
683 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
684 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
685 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
686 { WM_NCPAINT, sent|wparam|optional, 1 },
687 { WM_ERASEBKGND, sent|optional },
688 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_NOMOVE|SWP_NOSIZE },
689 { WM_ACTIVATEAPP, sent|wparam, 1 },
690 { WM_NCACTIVATE, sent },
691 { WM_ACTIVATE, sent|wparam, 1 },
692 { HCBT_SETFOCUS, hook },
693 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
694 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
695 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
696 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
697 { WM_GETTEXT, sent|optional },
698 { WM_SYNCPAINT, sent|wparam|optional, 4 },
699 { WM_NCPAINT, sent|wparam|optional, 1 },
700 { WM_ERASEBKGND, sent|optional },
701 { WM_NCPAINT, sent|wparam|defwinproc|optional, 1 },
702 { WM_ERASEBKGND, sent|defwinproc|optional },
703 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE },
704 { 0 }
705 };
706 /* CreateWindow(WS_MAXIMIZE) for popup window, not initially visible */
707 static const struct message WmCreateInvisibleMaxPopupSeq[] = {
708 { HCBT_CREATEWND, hook },
709 { WM_NCCREATE, sent },
710 { WM_NCCALCSIZE, sent|wparam, 0 },
711 { WM_CREATE, sent },
712 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
713 { WM_SIZE, sent|wparam, SIZE_RESTORED },
714 { WM_MOVE, sent },
715 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
716 { WM_GETMINMAXINFO, sent },
717 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },
718 { WM_NCCALCSIZE, sent|wparam, TRUE },
719 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_STATECHANGED },
720 { WM_MOVE, sent|defwinproc },
721 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
722 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
723 { 0 }
724 };
725 /* ShowWindow(SW_SHOWMAXIMIZED) for a resized not visible popup window */
726 static const struct message WmShowMaxPopupResizedSeq[] = {
727 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
728 { WM_GETMINMAXINFO, sent },
729 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED },
730 { WM_NCCALCSIZE, sent|wparam, TRUE },
731 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
732 { HCBT_ACTIVATE, hook },
733 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
734 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
735 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
736 { WM_NCPAINT, sent|wparam|optional, 1 },
737 { WM_ERASEBKGND, sent|optional },
738 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
739 { WM_ACTIVATEAPP, sent|wparam, 1 },
740 { WM_NCACTIVATE, sent },
741 { WM_ACTIVATE, sent|wparam, 1 },
742 { HCBT_SETFOCUS, hook },
743 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
744 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
745 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
746 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
747 { WM_GETTEXT, sent|optional },
748 { WM_NCPAINT, sent|wparam|optional, 1 },
749 { WM_ERASEBKGND, sent|optional },
750 { WM_WINDOWPOSCHANGED, sent },
751 /* WinNT4.0 sends WM_MOVE */
752 { WM_MOVE, sent|defwinproc|optional },
753 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
754 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
755 { 0 }
756 };
757 /* ShowWindow(SW_SHOWMAXIMIZED) for a not visible popup window */
758 static const struct message WmShowMaxPopupSeq[] = {
759 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
760 { WM_GETMINMAXINFO, sent },
761 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED },
762 { WM_NCCALCSIZE, sent|wparam, TRUE },
763 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
764 { HCBT_ACTIVATE, hook },
765 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
766 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
767 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
768 { WM_ACTIVATEAPP, sent|wparam, 1 },
769 { WM_NCACTIVATE, sent },
770 { WM_ACTIVATE, sent|wparam, 1 },
771 { HCBT_SETFOCUS, hook },
772 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
773 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
774 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
775 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
776 { WM_GETTEXT, sent|optional },
777 { WM_SYNCPAINT, sent|wparam|optional, 4 },
778 { WM_NCPAINT, sent|wparam|optional, 1 },
779 { WM_ERASEBKGND, sent|optional },
780 { WM_NCPAINT, sent|wparam|defwinproc|optional, 1 },
781 { WM_ERASEBKGND, sent|defwinproc|optional },
782 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE },
783 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
784 { 0 }
785 };
786 /* CreateWindow(WS_VISIBLE) for popup window */
787 static const struct message WmCreatePopupSeq[] = {
788 { HCBT_CREATEWND, hook },
789 { WM_NCCREATE, sent },
790 { WM_NCCALCSIZE, sent|wparam, 0 },
791 { WM_CREATE, sent },
792 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
793 { WM_SIZE, sent|wparam, SIZE_RESTORED },
794 { WM_MOVE, sent },
795 { WM_SHOWWINDOW, sent|wparam, 1 },
796 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
797 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
798 { HCBT_ACTIVATE, hook },
799 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
800 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
801 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
802 { WM_NCPAINT, sent|wparam|optional, 1 },
803 { WM_ERASEBKGND, sent|optional },
804 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
805 { WM_ACTIVATEAPP, sent|wparam, 1 },
806 { WM_NCACTIVATE, sent },
807 { WM_ACTIVATE, sent|wparam, 1 },
808 { HCBT_SETFOCUS, hook },
809 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
810 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
811 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
812 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
813 { WM_GETTEXT, sent|optional },
814 { WM_SYNCPAINT, sent|wparam|optional, 4 },
815 { WM_NCPAINT, sent|wparam|optional, 1 },
816 { WM_ERASEBKGND, sent|optional },
817 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE },
818 { 0 }
819 };
820 /* ShowWindow(SW_SHOWMAXIMIZED) for a visible popup window */
821 static const struct message WmShowVisMaxPopupSeq[] = {
822 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
823 { WM_GETMINMAXINFO, sent },
824 { WM_GETTEXT, sent|optional },
825 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
826 { WM_GETTEXT, sent|optional },
827 { WM_NCCALCSIZE, sent|wparam, TRUE },
828 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
829 { WM_NCPAINT, sent|wparam|optional, 1 },
830 { WM_ERASEBKGND, sent|optional },
831 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
832 { WM_MOVE, sent|defwinproc },
833 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
834 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
835 { 0 }
836 };
837 /* CreateWindow (for a child popup window, not initially visible) */
838 static const struct message WmCreateChildPopupSeq[] = {
839 { HCBT_CREATEWND, hook },
840 { WM_NCCREATE, sent },
841 { WM_NCCALCSIZE, sent|wparam, 0 },
842 { WM_CREATE, sent },
843 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
844 { WM_SIZE, sent|wparam, SIZE_RESTORED },
845 { WM_MOVE, sent },
846 { 0 }
847 };
848 /* CreateWindow (for a popup window, not initially visible,
849 * which sets WS_VISIBLE in WM_CREATE handler)
850 */
851 static const struct message WmCreateInvisiblePopupSeq[] = {
852 { HCBT_CREATEWND, hook },
853 { WM_NCCREATE, sent },
854 { WM_NCCALCSIZE, sent|wparam, 0 },
855 { WM_CREATE, sent },
856 { WM_STYLECHANGING, sent },
857 { WM_STYLECHANGED, sent },
858 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
859 { WM_SIZE, sent|wparam, SIZE_RESTORED },
860 { WM_MOVE, sent },
861 { 0 }
862 };
863 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER)
864 * for a popup window with WS_VISIBLE style set
865 */
866 static const struct message WmShowVisiblePopupSeq_2[] = {
867 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
868 { 0 }
869 };
870 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
871 * for a popup window with WS_VISIBLE style set
872 */
873 static const struct message WmShowVisiblePopupSeq_3[] = {
874 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
875 { HCBT_ACTIVATE, hook },
876 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
877 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
878 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
879 { WM_NCACTIVATE, sent },
880 { WM_ACTIVATE, sent|wparam, 1 },
881 { HCBT_SETFOCUS, hook },
882 { WM_KILLFOCUS, sent|parent },
883 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
884 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
885 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
886 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
887 { WM_SETFOCUS, sent|defwinproc },
888 { WM_GETTEXT, sent|optional },
889 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE, 0, SWP_SHOWWINDOW },
890 { 0 }
891 };
892 /* CreateWindow (for child window, not initially visible) */
893 static const struct message WmCreateChildSeq[] = {
894 { HCBT_CREATEWND, hook },
895 { WM_NCCREATE, sent },
896 /* child is inserted into parent's child list after WM_NCCREATE returns */
897 { WM_NCCALCSIZE, sent|wparam, 0 },
898 { WM_CREATE, sent },
899 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
900 { WM_SIZE, sent|wparam, SIZE_RESTORED },
901 { WM_MOVE, sent },
902 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
903 { 0 }
904 };
905 /* CreateWindow (for maximized child window, not initially visible) */
906 static const struct message WmCreateMaximizedChildSeq[] = {
907 { HCBT_CREATEWND, hook },
908 { WM_NCCREATE, sent },
909 { WM_NCCALCSIZE, sent|wparam, 0 },
910 { WM_CREATE, sent },
911 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
912 { WM_SIZE, sent|wparam, SIZE_RESTORED },
913 { WM_MOVE, sent },
914 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
915 { WM_GETMINMAXINFO, sent },
916 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
917 { WM_NCCALCSIZE, sent|wparam, 1 },
918 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
919 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
920 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
921 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
922 { 0 }
923 };
924 /* CreateWindow (for a child window, initially visible) */
925 static const struct message WmCreateVisibleChildSeq[] = {
926 { HCBT_CREATEWND, hook },
927 { WM_NCCREATE, sent },
928 /* child is inserted into parent's child list after WM_NCCREATE returns */
929 { WM_NCCALCSIZE, sent|wparam, 0 },
930 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
931 { WM_CREATE, sent },
932 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
933 { WM_SIZE, sent|wparam, SIZE_RESTORED },
934 { WM_MOVE, sent },
935 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
936 { WM_SHOWWINDOW, sent|wparam, 1 },
937 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
938 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
939 { WM_ERASEBKGND, sent|parent|optional },
940 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
941 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* WinXP */
942 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
943 { 0 }
944 };
945 /* ShowWindow(SW_SHOW) for a not visible child window */
946 static const struct message WmShowChildSeq[] = {
947 { WM_SHOWWINDOW, sent|wparam, 1 },
948 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
949 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
950 { WM_ERASEBKGND, sent|parent|optional },
951 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
952 { 0 }
953 };
954 /* ShowWindow(SW_HIDE) for a visible child window */
955 static const struct message WmHideChildSeq[] = {
956 { WM_SHOWWINDOW, sent|wparam, 0 },
957 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
958 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
959 { WM_ERASEBKGND, sent|parent|optional },
960 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
961 { 0 }
962 };
963 /* ShowWindow(SW_HIDE) for a visible child window checking all parent events*/
964 static const struct message WmHideChildSeq2[] = {
965 { WM_SHOWWINDOW, sent|wparam, 0 },
966 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
967 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
968 { WM_ERASEBKGND, sent|parent|optional },
969 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
970 { 0 }
971 };
972 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
973 * for a not visible child window
974 */
975 static const struct message WmShowChildSeq_2[] = {
976 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
977 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
978 { WM_CHILDACTIVATE, sent },
979 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
980 { 0 }
981 };
982 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE)
983 * for a not visible child window
984 */
985 static const struct message WmShowChildSeq_3[] = {
986 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
987 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
988 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
989 { 0 }
990 };
991 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
992 * for a visible child window with a caption
993 */
994 static const struct message WmShowChildSeq_4[] = {
995 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
996 { WM_CHILDACTIVATE, sent },
997 { 0 }
998 };
999 /* ShowWindow(SW_MINIMIZE) for child with invisible parent */
1000 static const struct message WmShowChildInvisibleParentSeq_1[] = {
1001 { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
1002 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
1003 { WM_NCCALCSIZE, sent|wparam, 1 },
1004 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1005 { WM_CHILDACTIVATE, sent|optional },
1006 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
1007 { WM_MOVE, sent|defwinproc },
1008 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1009 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1010 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1011 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1012 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1013 { WM_GETTEXT, sent|optional },
1014 { 0 }
1015 };
1016 /* repeated ShowWindow(SW_MINIMIZE) for child with invisible parent */
1017 static const struct message WmShowChildInvisibleParentSeq_1r[] = {
1018 { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
1019 { 0 }
1020 };
1021 /* ShowWindow(SW_MAXIMIZE) for child with invisible parent */
1022 static const struct message WmShowChildInvisibleParentSeq_2[] = {
1023 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
1024 { WM_GETMINMAXINFO, sent },
1025 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
1026 { WM_NCCALCSIZE, sent|wparam, 1 },
1027 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1028 { WM_CHILDACTIVATE, sent },
1029 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
1030 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
1031 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1032 { 0 }
1033 };
1034 /* repeated ShowWindow(SW_MAXIMIZE) for child with invisible parent */
1035 static const struct message WmShowChildInvisibleParentSeq_2r[] = {
1036 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
1037 { 0 }
1038 };
1039 /* ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
1040 static const struct message WmShowChildInvisibleParentSeq_3[] = {
1041 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINIMIZED },
1042 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
1043 { WM_NCCALCSIZE, sent|wparam, 1 },
1044 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1045 { WM_CHILDACTIVATE, sent },
1046 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED },
1047 { WM_MOVE, sent|defwinproc },
1048 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1049 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1050 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1051 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1052 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1053 { WM_GETTEXT, sent|optional },
1054 { 0 }
1055 };
1056 /* repeated ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
1057 static const struct message WmShowChildInvisibleParentSeq_3r[] = {
1058 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINIMIZED },
1059 { 0 }
1060 };
1061 /* ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
1062 static const struct message WmShowChildInvisibleParentSeq_4[] = {
1063 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINNOACTIVE },
1064 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_STATECHANGED },
1065 { WM_NCCALCSIZE, sent|wparam, 1 },
1066 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1067 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED },
1068 { WM_MOVE, sent|defwinproc },
1069 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1070 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1071 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1072 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1073 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1074 { WM_GETTEXT, sent|optional },
1075 { 0 }
1076 };
1077 /* repeated ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
1078 static const struct message WmShowChildInvisibleParentSeq_4r[] = {
1079 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINNOACTIVE },
1080 { 0 }
1081 };
1082 /* ShowWindow(SW_SHOW) for child with invisible parent */
1083 static const struct message WmShowChildInvisibleParentSeq_5[] = {
1084 { WM_SHOWWINDOW, sent|wparam, 1 },
1085 { 0 }
1086 };
1087 /* ShowWindow(SW_HIDE) for child with invisible parent */
1088 static const struct message WmHideChildInvisibleParentSeq[] = {
1089 { WM_SHOWWINDOW, sent|wparam, 0 },
1090 { 0 }
1091 };
1092 /* SetWindowPos(SWP_SHOWWINDOW) for child with invisible parent */
1093 static const struct message WmShowChildInvisibleParentSeq_6[] = {
1094 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1095 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1096 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1097 { 0 }
1098 };
1099 /* SetWindowPos(SWP_HIDEWINDOW) for child with invisible parent */
1100 static const struct message WmHideChildInvisibleParentSeq_2[] = {
1101 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1102 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1103 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1104 { 0 }
1105 };
1106 /* DestroyWindow for a visible child window */
1107 static const struct message WmDestroyChildSeq[] = {
1108 { HCBT_DESTROYWND, hook },
1109 { 0x0090, sent|optional },
1110 { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY },
1111 { WM_SHOWWINDOW, sent|wparam, 0 },
1112 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1113 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1114 { WM_ERASEBKGND, sent|parent|optional },
1115 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1116 { HCBT_SETFOCUS, hook }, /* set focus to a parent */
1117 { WM_KILLFOCUS, sent },
1118 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
1119 { WM_IME_SETCONTEXT, sent|wparam|parent|optional, 1 },
1120 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1121 { WM_SETFOCUS, sent|parent },
1122 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1123 { WM_DESTROY, sent },
1124 { WM_DESTROY, sent|optional }, /* some other (IME?) window */
1125 { WM_NCDESTROY, sent|optional }, /* some other (IME?) window */
1126 { WM_NCDESTROY, sent },
1127 { 0 }
1128 };
1129 /* visible child window destroyed by thread exit */
1130 static const struct message WmExitThreadSeq[] = {
1131 { WM_NCDESTROY, sent }, /* actually in grandchild */
1132 { WM_PAINT, sent|parent },
1133 { WM_ERASEBKGND, sent|parent|beginpaint },
1134 { 0 }
1135 };
1136 /* DestroyWindow for a visible child window with invisible parent */
1137 static const struct message WmDestroyInvisibleChildSeq[] = {
1138 { HCBT_DESTROYWND, hook },
1139 { 0x0090, sent|optional },
1140 { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY },
1141 { WM_SHOWWINDOW, sent|wparam, 0 },
1142 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1143 { WM_DESTROY, sent },
1144 { WM_NCDESTROY, sent },
1145 { 0 }
1146 };
1147 /* Moving the mouse in nonclient area */
1148 static const struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */
1149 { WM_NCHITTEST, sent },
1150 { WM_SETCURSOR, sent },
1151 { WM_NCMOUSEMOVE, posted },
1152 { 0 }
1153 };
1154 /* Moving the mouse in client area */
1155 static const struct message WmMouseMoveInClientAreaSeq[] = { /* FIXME: add */
1156 { WM_NCHITTEST, sent },
1157 { WM_SETCURSOR, sent },
1158 { WM_MOUSEMOVE, posted },
1159 { 0 }
1160 };
1161 /* Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
1162 static const struct message WmDragTitleBarSeq[] = { /* FIXME: add */
1163 { WM_NCLBUTTONDOWN, sent|wparam, HTCAPTION },
1164 { WM_SYSCOMMAND, sent|defwinproc|wparam, SC_MOVE+2 },
1165 { WM_GETMINMAXINFO, sent|defwinproc },
1166 { WM_ENTERSIZEMOVE, sent|defwinproc },
1167 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, 0 },
1168 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, 0 },
1169 { WM_MOVE, sent|defwinproc },
1170 { WM_EXITSIZEMOVE, sent|defwinproc },
1171 { 0 }
1172 };
1173 /* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
1174 static const struct message WmDragThickBordersBarSeq[] = { /* FIXME: add */
1175 { WM_NCLBUTTONDOWN, sent|wparam, 0xd },
1176 { WM_SYSCOMMAND, sent|defwinproc|wparam, 0xf004 },
1177 { WM_GETMINMAXINFO, sent|defwinproc },
1178 { WM_ENTERSIZEMOVE, sent|defwinproc },
1179 { WM_SIZING, sent|defwinproc|wparam, 4}, /* one for each mouse movement */
1180 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, 0 },
1181 { WM_GETMINMAXINFO, sent|defwinproc },
1182 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
1183 { WM_NCPAINT, sent|defwinproc|wparam, 1 },
1184 { WM_GETTEXT, sent|defwinproc },
1185 { WM_ERASEBKGND, sent|defwinproc },
1186 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, 0 },
1187 { WM_MOVE, sent|defwinproc },
1188 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1189 { WM_EXITSIZEMOVE, sent|defwinproc },
1190 { 0 }
1191 };
1192 /* Resizing child window with MoveWindow (32) */
1193 static const struct message WmResizingChildWithMoveWindowSeq[] = {
1194 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
1195 { WM_NCCALCSIZE, sent|wparam, 1 },
1196 { WM_ERASEBKGND, sent|parent|optional },
1197 { WM_ERASEBKGND, sent|optional },
1198 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE },
1199 { WM_MOVE, sent|defwinproc },
1200 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1201 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1202 { 0 }
1203 };
1204 /* Clicking on inactive button */
1205 static const struct message WmClickInactiveButtonSeq[] = { /* FIXME: add */
1206 { WM_NCHITTEST, sent },
1207 { WM_PARENTNOTIFY, sent|parent|wparam, WM_LBUTTONDOWN },
1208 { WM_MOUSEACTIVATE, sent },
1209 { WM_MOUSEACTIVATE, sent|parent|defwinproc },
1210 { WM_SETCURSOR, sent },
1211 { WM_SETCURSOR, sent|parent|defwinproc },
1212 { WM_LBUTTONDOWN, posted },
1213 { WM_KILLFOCUS, posted|parent },
1214 { WM_SETFOCUS, posted },
1215 { WM_CTLCOLORBTN, posted|parent },
1216 { BM_SETSTATE, posted },
1217 { WM_CTLCOLORBTN, posted|parent },
1218 { WM_LBUTTONUP, posted },
1219 { BM_SETSTATE, posted },
1220 { WM_CTLCOLORBTN, posted|parent },
1221 { WM_COMMAND, posted|parent },
1222 { 0 }
1223 };
1224 /* Reparenting a button (16/32) */
1225 /* The last child (button) reparented gets topmost for its new parent. */
1226 static const struct message WmReparentButtonSeq[] = { /* FIXME: add */
1227 { WM_SHOWWINDOW, sent|wparam, 0 },
1228 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1229 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1230 { WM_ERASEBKGND, sent|parent },
1231 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1232 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE },
1233 { WM_CHILDACTIVATE, sent },
1234 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOREDRAW },
1235 { WM_MOVE, sent|defwinproc },
1236 { WM_SHOWWINDOW, sent|wparam, 1 },
1237 { 0 }
1238 };
1239 /* Creation of a custom dialog (32) */
1240 static const struct message WmCreateCustomDialogSeq[] = {
1241 { HCBT_CREATEWND, hook },
1242 { WM_GETMINMAXINFO, sent },
1243 { WM_NCCREATE, sent },
1244 { WM_NCCALCSIZE, sent|wparam, 0 },
1245 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1246 { WM_CREATE, sent },
1247 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1248 { WM_NOTIFYFORMAT, sent|optional },
1249 { WM_QUERYUISTATE, sent|optional },
1250 { WM_WINDOWPOSCHANGING, sent|optional },
1251 { WM_GETMINMAXINFO, sent|optional },
1252 { WM_NCCALCSIZE, sent|optional },
1253 { WM_WINDOWPOSCHANGED, sent|optional },
1254 { WM_SHOWWINDOW, sent|wparam, 1 },
1255 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
1256 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1257 { HCBT_ACTIVATE, hook },
1258 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1259
1260
1261 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1262
1263 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
1264
1265 { WM_NCACTIVATE, sent },
1266 { WM_GETTEXT, sent|optional|defwinproc },
1267 { WM_GETTEXT, sent|optional|defwinproc },
1268 { WM_GETTEXT, sent|optional|defwinproc },
1269 { EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
1270 { WM_ACTIVATE, sent|wparam, 1 },
1271 { WM_GETTEXT, sent|optional },
1272 { WM_KILLFOCUS, sent|parent },
1273 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1274 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
1275 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
1276 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1277 { WM_SETFOCUS, sent },
1278 { WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
1279 { WM_NCPAINT, sent|wparam, 1 },
1280 { WM_GETTEXT, sent|optional|defwinproc },
1281 { WM_GETTEXT, sent|optional|defwinproc },
1282 { WM_ERASEBKGND, sent },
1283 { WM_CTLCOLORDLG, sent|optional|defwinproc },
1284 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1285 { WM_GETTEXT, sent|optional },
1286 { WM_GETTEXT, sent|optional },
1287 { WM_NCCALCSIZE, sent|optional },
1288 { WM_NCPAINT, sent|optional },
1289 { WM_GETTEXT, sent|optional|defwinproc },
1290 { WM_GETTEXT, sent|optional|defwinproc },
1291 { WM_ERASEBKGND, sent|optional },
1292 { WM_CTLCOLORDLG, sent|optional|defwinproc },
1293 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1294 { WM_SIZE, sent|wparam, SIZE_RESTORED },
1295 { WM_MOVE, sent },
1296 { 0 }
1297 };
1298 /* Calling EndDialog for a custom dialog (32) */
1299 static const struct message WmEndCustomDialogSeq[] = {
1300 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1301 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1302 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1303 { WM_GETTEXT, sent|optional },
1304 { HCBT_ACTIVATE, hook },
1305 { WM_NCACTIVATE, sent|wparam, 0 },
1306 { WM_GETTEXT, sent|optional|defwinproc },
1307 { WM_GETTEXT, sent|optional|defwinproc },
1308 { WM_ACTIVATE, sent|wparam, 0 },
1309 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1310 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1311 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1312 { WM_GETTEXT, sent|optional|defwinproc },
1313 { WM_GETTEXT, sent|optional|defwinproc },
1314 { HCBT_SETFOCUS, hook },
1315 { WM_KILLFOCUS, sent },
1316 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
1317 { WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 },
1318 { WM_IME_NOTIFY, sent|wparam|optional, 1 },
1319 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1320 { WM_SETFOCUS, sent|parent|defwinproc },
1321 { 0 }
1322 };
1323 /* ShowWindow(SW_SHOW) for a custom dialog (initially invisible) */
1324 static const struct message WmShowCustomDialogSeq[] = {
1325 { WM_SHOWWINDOW, sent|wparam, 1 },
1326 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
1327 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1328 { HCBT_ACTIVATE, hook },
1329 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1330
1331 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1332
1333 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
1334 { WM_ACTIVATEAPP, sent|wparam|optional, 1 },
1335 { WM_NCACTIVATE, sent },
1336 { WM_ACTIVATE, sent|wparam, 1 },
1337 { WM_GETTEXT, sent|optional },
1338
1339 { WM_KILLFOCUS, sent|parent },
1340 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1341 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
1342 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
1343 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1344 { WM_SETFOCUS, sent },
1345 { WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
1346 { WM_NCPAINT, sent|wparam, 1 },
1347 { WM_ERASEBKGND, sent },
1348 { WM_CTLCOLORDLG, sent|defwinproc },
1349 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1350 { 0 }
1351 };
1352 /* Creation and destruction of a modal dialog (32) */
1353 static const struct message WmModalDialogSeq[] = {
1354 { WM_CANCELMODE, sent|parent },
1355 { HCBT_SETFOCUS, hook },
1356 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1357 { WM_KILLFOCUS, sent|parent },
1358 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1359 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1360 { WM_ENABLE, sent|parent|wparam, 0 },
1361 { HCBT_CREATEWND, hook },
1362 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1363 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1364 { WM_SETFONT, sent },
1365 { WM_INITDIALOG, sent },
1366 { WM_CHANGEUISTATE, sent|optional },
1367 { WM_UPDATEUISTATE, sent|optional },
1368 { WM_SHOWWINDOW, sent },
1369 { HCBT_ACTIVATE, hook },
1370 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1371 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1372 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOMOVE },
1373 { WM_NCACTIVATE, sent },
1374 { WM_GETTEXT, sent|optional },
1375 { WM_ACTIVATE, sent|wparam, 1 },
1376 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1377 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1378 { WM_NCPAINT, sent|optional },
1379 { WM_GETTEXT, sent|optional },
1380 { WM_ERASEBKGND, sent|optional },
1381 { WM_CTLCOLORDLG, sent|optional },
1382 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1383 { WM_GETTEXT, sent|optional },
1384 { WM_NCCALCSIZE, sent|optional },
1385 { WM_NCPAINT, sent|optional },
1386 { WM_GETTEXT, sent|optional },
1387 { WM_ERASEBKGND, sent|optional },
1388 { WM_CTLCOLORDLG, sent|optional },
1389 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1390 { WM_PAINT, sent|optional },
1391 { WM_CTLCOLORBTN, sent|optional },
1392 { WM_GETTITLEBARINFOEX, sent|optional },
1393 { WM_ENTERIDLE, sent|parent|optional },
1394 { WM_ENTERIDLE, sent|parent|optional },
1395 { WM_ENTERIDLE, sent|parent|optional },
1396 { WM_ENTERIDLE, sent|parent|optional },
1397 { WM_ENTERIDLE, sent|parent|optional },
1398 { WM_ENTERIDLE, sent|parent|optional },
1399 { WM_ENTERIDLE, sent|parent|optional },
1400 { WM_ENTERIDLE, sent|parent|optional },
1401 { WM_ENTERIDLE, sent|parent|optional },
1402 { WM_ENTERIDLE, sent|parent|optional },
1403 { WM_ENTERIDLE, sent|parent|optional },
1404 { WM_ENTERIDLE, sent|parent|optional },
1405 { WM_ENTERIDLE, sent|parent|optional },
1406 { WM_ENTERIDLE, sent|parent|optional },
1407 { WM_ENTERIDLE, sent|parent|optional },
1408 { WM_ENTERIDLE, sent|parent|optional },
1409 { WM_ENTERIDLE, sent|parent|optional },
1410 { WM_ENTERIDLE, sent|parent|optional },
1411 { WM_ENTERIDLE, sent|parent|optional },
1412 { WM_ENTERIDLE, sent|parent|optional },
1413 { WM_TIMER, sent },
1414 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1415 { WM_ENABLE, sent|parent|wparam, 1 },
1416 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1417 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1418 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1419 { WM_GETTEXT, sent|optional },
1420 { HCBT_ACTIVATE, hook },
1421 { WM_NCACTIVATE, sent|wparam, 0 },
1422 { WM_GETTEXT, sent|optional },
1423 { WM_ACTIVATE, sent|wparam, 0 },
1424 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1425 { WM_WINDOWPOSCHANGING, sent|optional },
1426 { WM_WINDOWPOSCHANGED, sent|optional },
1427 { HCBT_SETFOCUS, hook },
1428 { WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 },
1429 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1430 { WM_SETFOCUS, sent|parent|defwinproc },
1431 { EVENT_SYSTEM_DIALOGEND, winevent_hook|wparam|lparam, 0, 0 },
1432 { HCBT_DESTROYWND, hook },
1433 { 0x0090, sent|optional },
1434 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1435 { WM_DESTROY, sent },
1436 { WM_NCDESTROY, sent },
1437 { 0 }
1438 };
1439 /* Creation of a modal dialog that is resized inside WM_INITDIALOG (32) */
1440 static const struct message WmCreateModalDialogResizeSeq[] = { /* FIXME: add */
1441 /* (inside dialog proc, handling WM_INITDIALOG) */
1442 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1443 { WM_NCCALCSIZE, sent },
1444 { WM_NCACTIVATE, sent|parent|wparam, 0 },
1445 { WM_GETTEXT, sent|defwinproc },
1446 { WM_ACTIVATE, sent|parent|wparam, 0 },
1447 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1448 { WM_WINDOWPOSCHANGING, sent|parent },
1449 { WM_NCACTIVATE, sent|wparam, 1 },
1450 { WM_ACTIVATE, sent|wparam, 1 },
1451 { WM_WINDOWPOSCHANGED, sent|wparam, 0 },
1452 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1453 /* (setting focus) */
1454 { WM_SHOWWINDOW, sent|wparam, 1 },
1455 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1456 { WM_NCPAINT, sent },
1457 { WM_GETTEXT, sent|defwinproc },
1458 { WM_ERASEBKGND, sent },
1459 { WM_CTLCOLORDLG, sent|defwinproc },
1460 { WM_WINDOWPOSCHANGED, sent|wparam, 0 },
1461 { WM_PAINT, sent },
1462 /* (bunch of WM_CTLCOLOR* for each control) */
1463 { WM_PAINT, sent|parent },
1464 { WM_ENTERIDLE, sent|parent|wparam, 0 },
1465 { WM_SETCURSOR, sent|parent },
1466 { 0 }
1467 };
1468 /* SetMenu for NonVisible windows with size change*/
1469 static const struct message WmSetMenuNonVisibleSizeChangeSeq[] = {
1470 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1471 { WM_NCCALCSIZE, sent|wparam, 1 },
1472 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1473 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW },
1474 { WM_MOVE, sent|defwinproc },
1475 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1476 { WM_NCCALCSIZE,sent|wparam|optional, 1 }, /* XP */
1477 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1478 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
1479 { WM_GETTEXT, sent|optional },
1480 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1481 { 0 }
1482 };
1483 /* SetMenu for NonVisible windows with no size change */
1484 static const struct message WmSetMenuNonVisibleNoSizeChangeSeq[] = {
1485 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1486 { WM_NCCALCSIZE, sent|wparam, 1 },
1487 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1488 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1489 { 0 }
1490 };
1491 /* SetMenu for Visible windows with size change */
1492 static const struct message WmSetMenuVisibleSizeChangeSeq[] = {
1493 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1494 { WM_NCCALCSIZE, sent|wparam, 1 },
1495 { 0x0093, sent|defwinproc|optional },
1496 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1497 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1498 { 0x0093, sent|defwinproc|optional },
1499 { 0x0093, sent|defwinproc|optional },
1500 { 0x0091, sent|defwinproc|optional },
1501 { 0x0092, sent|defwinproc|optional },
1502 { WM_GETTEXT, sent|defwinproc|optional },
1503 { WM_ERASEBKGND, sent|optional },
1504 { WM_ACTIVATE, sent|optional },
1505 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1506 { WM_MOVE, sent|defwinproc },
1507 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1508 { 0x0093, sent|optional },
1509 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1510 { 0x0093, sent|defwinproc|optional },
1511 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1512 { 0x0093, sent|defwinproc|optional },
1513 { 0x0093, sent|defwinproc|optional },
1514 { 0x0091, sent|defwinproc|optional },
1515 { 0x0092, sent|defwinproc|optional },
1516 { WM_ERASEBKGND, sent|optional },
1517 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1518 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
1519 { 0 }
1520 };
1521 /* SetMenu for Visible windows with no size change */
1522 static const struct message WmSetMenuVisibleNoSizeChangeSeq[] = {
1523 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1524 { WM_NCCALCSIZE, sent|wparam, 1 },
1525 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1526 { WM_GETTEXT, sent|defwinproc|optional },
1527 { WM_ERASEBKGND, sent|optional },
1528 { WM_ACTIVATE, sent|optional },
1529 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1530 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1531 { 0 }
1532 };
1533 /* DrawMenuBar for a visible window */
1534 static const struct message WmDrawMenuBarSeq[] =
1535 {
1536 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1537 { WM_NCCALCSIZE, sent|wparam, 1 },
1538 { 0x0093, sent|defwinproc|optional },
1539 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1540 { 0x0093, sent|defwinproc|optional },
1541 { 0x0093, sent|defwinproc|optional },
1542 { 0x0091, sent|defwinproc|optional },
1543 { 0x0092, sent|defwinproc|optional },
1544 { WM_GETTEXT, sent|defwinproc|optional },
1545 { WM_ERASEBKGND, sent|optional },
1546 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1547 { 0x0093, sent|optional },
1548 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1549 { 0 }
1550 };
1551
1552 static const struct message WmSetRedrawFalseSeq[] =
1553 {
1554 { WM_SETREDRAW, sent|wparam, 0 },
1555 { 0 }
1556 };
1557
1558 static const struct message WmSetRedrawTrueSeq[] =
1559 {
1560 { WM_SETREDRAW, sent|wparam, 1 },
1561 { 0 }
1562 };
1563
1564 static const struct message WmEnableWindowSeq_1[] =
1565 {
1566 { WM_CANCELMODE, sent|wparam|lparam, 0, 0 },
1567 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1568 { HCBT_SETFOCUS, hook|optional },
1569 { WM_KILLFOCUS, sent|optional },
1570 { WM_ENABLE, sent|wparam|lparam, FALSE, 0 },
1571 { 0 }
1572 };
1573
1574 static const struct message WmEnableWindowSeq_2[] =
1575 {
1576 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1577 { WM_ENABLE, sent|wparam|lparam, TRUE, 0 },
1578 { 0 }
1579 };
1580
1581 static const struct message WmGetScrollRangeSeq[] =
1582 {
1583 { SBM_GETRANGE, sent },
1584 { 0 }
1585 };
1586 static const struct message WmGetScrollInfoSeq[] =
1587 {
1588 { SBM_GETSCROLLINFO, sent },
1589 { 0 }
1590 };
1591 static const struct message WmSetScrollRangeSeq[] =
1592 {
1593 /* MSDN claims that Windows sends SBM_SETRANGE message, but win2k SP4
1594 sends SBM_SETSCROLLINFO.
1595 */
1596 { SBM_SETSCROLLINFO, sent },
1597 { 0 }
1598 };
1599 /* SetScrollRange for a window without a non-client area */
1600 static const struct message WmSetScrollRangeHSeq_empty[] =
1601 {
1602 { EVENT_OBJECT_VALUECHANGE, winevent_hook|wparam|lparam, OBJID_HSCROLL, 0 },
1603 { 0 }
1604 };
1605 static const struct message WmSetScrollRangeVSeq_empty[] =
1606 {
1607 { EVENT_OBJECT_VALUECHANGE, winevent_hook|wparam|lparam, OBJID_VSCROLL, 0 },
1608 { 0 }
1609 };
1610 static const struct message WmSetScrollRangeHVSeq[] =
1611 {
1612 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1613 { WM_NCCALCSIZE, sent|wparam, 1 },
1614 { WM_GETTEXT, sent|defwinproc|optional },
1615 { WM_ERASEBKGND, sent|optional },
1616 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1617 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1618 { EVENT_OBJECT_VALUECHANGE, winevent_hook|lparam|optional, 0/*OBJID_HSCROLL or OBJID_VSCROLL*/, 0 },
1619 { 0 }
1620 };
1621 /* SetScrollRange for a window with a non-client area */
1622 static const struct message WmSetScrollRangeHV_NC_Seq[] =
1623 {
1624 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1625 { WM_NCCALCSIZE, sent|wparam, 1 },
1626 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1627 { WM_NCPAINT, sent|optional },
1628 { WM_STYLECHANGING, sent|defwinproc|optional },
1629 { WM_STYLECHANGED, sent|defwinproc|optional },
1630 { WM_STYLECHANGING, sent|defwinproc|optional },
1631 { WM_STYLECHANGED, sent|defwinproc|optional },
1632 { WM_STYLECHANGING, sent|defwinproc|optional },
1633 { WM_STYLECHANGED, sent|defwinproc|optional },
1634 { WM_STYLECHANGING, sent|defwinproc|optional },
1635 { WM_STYLECHANGED, sent|defwinproc|optional },
1636 { WM_GETTEXT, sent|defwinproc|optional },
1637 { WM_GETTEXT, sent|defwinproc|optional },
1638 { WM_ERASEBKGND, sent|optional },
1639 { WM_CTLCOLORDLG, sent|defwinproc|optional }, /* sent to a parent of the dialog */
1640 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOCLIENTMOVE, 0, SWP_NOCLIENTSIZE },
1641 { WM_SIZE, sent|defwinproc|optional },
1642 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1643 { EVENT_OBJECT_VALUECHANGE, winevent_hook|lparam|optional, 0/*OBJID_HSCROLL or OBJID_VSCROLL*/, 0 },
1644 { WM_GETTEXT, sent|optional },
1645 { WM_GETTEXT, sent|optional },
1646 { WM_GETTEXT, sent|optional },
1647 { WM_GETTEXT, sent|optional },
1648 { 0 }
1649 };
1650 /* test if we receive the right sequence of messages */
1651 /* after calling ShowWindow( SW_SHOWNA) */
1652 static const struct message WmSHOWNAChildInvisParInvis[] = {
1653 { WM_SHOWWINDOW, sent|wparam, 1 },
1654 { 0 }
1655 };
1656 static const struct message WmSHOWNAChildVisParInvis[] = {
1657 { WM_SHOWWINDOW, sent|wparam, 1 },
1658 { 0 }
1659 };
1660 static const struct message WmSHOWNAChildVisParVis[] = {
1661 { WM_SHOWWINDOW, sent|wparam, 1 },
1662 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1663 { 0 }
1664 };
1665 static const struct message WmSHOWNAChildInvisParVis[] = {
1666 { WM_SHOWWINDOW, sent|wparam, 1 },
1667 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1668 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1669 { WM_ERASEBKGND, sent|optional },
1670 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOACTIVATE|SWP_NOCLIENTMOVE },
1671 { 0 }
1672 };
1673 static const struct message WmSHOWNATopVisible[] = {
1674 { WM_SHOWWINDOW, sent|wparam, 1 },
1675 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1676 { WM_NCPAINT, sent|wparam|optional, 1 },
1677 { WM_GETTEXT, sent|defwinproc|optional },
1678 { WM_ERASEBKGND, sent|optional },
1679 { WM_WINDOWPOSCHANGED, sent|optional },
1680 { 0 }
1681 };
1682 static const struct message WmSHOWNATopInvisible[] = {
1683 { WM_NOTIFYFORMAT, sent|optional },
1684 { WM_QUERYUISTATE, sent|optional },
1685 { WM_WINDOWPOSCHANGING, sent|optional },
1686 { WM_GETMINMAXINFO, sent|optional },
1687 { WM_NCCALCSIZE, sent|optional },
1688 { WM_WINDOWPOSCHANGED, sent|optional },
1689 { WM_SHOWWINDOW, sent|wparam, 1 },
1690 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1691 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1692 { WM_NCPAINT, sent|wparam|optional, 1 },
1693 { WM_GETTEXT, sent|defwinproc|optional },
1694 { WM_ERASEBKGND, sent|optional },
1695 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1696 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1697 { WM_NCPAINT, sent|wparam|optional, 1 },
1698 { WM_ERASEBKGND, sent|optional },
1699 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1700 { WM_SIZE, sent|wparam, SIZE_RESTORED },
1701 { WM_MOVE, sent },
1702 { 0 }
1703 };
1704
1705 static int after_end_dialog, test_def_id;
1706 static int sequence_cnt, sequence_size;
1707 static struct recvd_message* sequence;
1708 static int log_all_parent_messages;
1709 static int paint_loop_done;
1710
1711 /* user32 functions */
1712 static HWND (WINAPI *pGetAncestor)(HWND,UINT);
1713 static BOOL (WINAPI *pGetMenuInfo)(HMENU,LPCMENUINFO);
1714 static void (WINAPI *pNotifyWinEvent)(DWORD, HWND, LONG, LONG);
1715 static BOOL (WINAPI *pSetMenuInfo)(HMENU,LPCMENUINFO);
1716 static HWINEVENTHOOK (WINAPI *pSetWinEventHook)(DWORD, DWORD, HMODULE, WINEVENTPROC, DWORD, DWORD, DWORD);
1717 static BOOL (WINAPI *pTrackMouseEvent)(TRACKMOUSEEVENT*);
1718 static BOOL (WINAPI *pUnhookWinEvent)(HWINEVENTHOOK);
1719 /* kernel32 functions */
1720 static BOOL (WINAPI *pGetCPInfoExA)(UINT, DWORD, LPCPINFOEXA);
1721
1722 static void init_procs(void)
1723 {
1724 HMODULE user32 = GetModuleHandleA("user32.dll");
1725 HMODULE kernel32 = GetModuleHandleA("kernel32.dll");
1726
1727 #define GET_PROC(dll, func) \
1728 p ## func = (void*)GetProcAddress(dll, #func); \
1729 if(!p ## func) { \
1730 trace("GetProcAddress(%s) failed\n", #func); \
1731 }
1732
1733 GET_PROC(user32, GetAncestor)
1734 GET_PROC(user32, GetMenuInfo)
1735 GET_PROC(user32, NotifyWinEvent)
1736 GET_PROC(user32, SetMenuInfo)
1737 GET_PROC(user32, SetWinEventHook)
1738 GET_PROC(user32, TrackMouseEvent)
1739 GET_PROC(user32, UnhookWinEvent)
1740
1741 GET_PROC(kernel32, GetCPInfoExA)
1742
1743 #undef GET_PROC
1744 }
1745
1746 static const char *get_winpos_flags(UINT flags)
1747 {
1748 static char buffer[300];
1749
1750 buffer[0] = 0;
1751 #define DUMP(flag) do { if (flags & flag) { strcat( buffer, "|" #flag ); flags &= ~flag; } } while(0)
1752 DUMP( SWP_SHOWWINDOW );
1753 DUMP( SWP_HIDEWINDOW );
1754 DUMP( SWP_NOACTIVATE );
1755 DUMP( SWP_FRAMECHANGED );
1756 DUMP( SWP_NOCOPYBITS );
1757 DUMP( SWP_NOOWNERZORDER );
1758 DUMP( SWP_NOSENDCHANGING );
1759 DUMP( SWP_DEFERERASE );
1760 DUMP( SWP_ASYNCWINDOWPOS );
1761 DUMP( SWP_NOZORDER );
1762 DUMP( SWP_NOREDRAW );
1763 DUMP( SWP_NOSIZE );
1764 DUMP( SWP_NOMOVE );
1765 DUMP( SWP_NOCLIENTSIZE );
1766 DUMP( SWP_NOCLIENTMOVE );
1767 if (flags) sprintf(buffer + strlen(buffer),"|0x%04x", flags);
1768 return buffer + 1;
1769 #undef DUMP
1770 }
1771
1772 static BOOL ignore_message( UINT message )
1773 {
1774 /* these are always ignored */
1775 return (message >= 0xc000 ||
1776 message == WM_GETICON ||
1777 message == WM_GETOBJECT ||
1778 message == WM_TIMECHANGE ||
1779 message == WM_DISPLAYCHANGE ||
1780 message == WM_DEVICECHANGE ||
1781 message == WM_DWMNCRENDERINGCHANGED);
1782 }
1783
1784
1785 #define add_message(msg) add_message_(__LINE__,msg);
1786 static void add_message_(int line, const struct recvd_message *msg)
1787 {
1788 struct recvd_message *seq;
1789
1790 if (!sequence)
1791 {
1792 sequence_size = 10;
1793 sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof(*sequence) );
1794 }
1795 if (sequence_cnt == sequence_size)
1796 {
1797 sequence_size *= 2;
1798 sequence = HeapReAlloc( GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence) );
1799 }
1800 assert(sequence);
1801
1802 seq = &sequence[sequence_cnt];
1803 seq->hwnd = msg->hwnd;
1804 seq->message = msg->message;
1805 seq->flags = msg->flags;
1806 seq->wParam = msg->wParam;
1807 seq->lParam = msg->lParam;
1808 seq->line = line;
1809 seq->descr = msg->descr;
1810 seq->output[0] = 0;
1811
1812 if (msg->descr)
1813 {
1814 if (msg->flags & hook)
1815 {
1816 static const char * const CBT_code_name[10] =
1817 {
1818 "HCBT_MOVESIZE",
1819 "HCBT_MINMAX",
1820 "HCBT_QS",
1821 "HCBT_CREATEWND",
1822 "HCBT_DESTROYWND",
1823 "HCBT_ACTIVATE",
1824 "HCBT_CLICKSKIPPED",
1825 "HCBT_KEYSKIPPED",
1826 "HCBT_SYSCOMMAND",
1827 "HCBT_SETFOCUS"
1828 };
1829 const char *code_name = (msg->message <= HCBT_SETFOCUS) ? CBT_code_name[msg->message] : "Unknown";
1830
1831 sprintf( seq->output, "%s: hook %d (%s) wp %08lx lp %08lx",
1832 msg->descr, msg->message, code_name, msg->wParam, msg->lParam );
1833 }
1834 else if (msg->flags & winevent_hook)
1835 {
1836 sprintf( seq->output, "%s: winevent %p %08x %08lx %08lx",
1837 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
1838 }
1839 else
1840 {
1841 switch (msg->message)
1842 {
1843 case WM_WINDOWPOSCHANGING:
1844 case WM_WINDOWPOSCHANGED:
1845 {
1846 WINDOWPOS *winpos = (WINDOWPOS *)msg->lParam;
1847
1848 sprintf( seq->output, "%s: %p WM_WINDOWPOS%s wp %08lx lp %08lx after %p x %d y %d cx %d cy %d flags %s",
1849 msg->descr, msg->hwnd,
1850 (msg->message == WM_WINDOWPOSCHANGING) ? "CHANGING" : "CHANGED",
1851 msg->wParam, msg->lParam, winpos->hwndInsertAfter,
1852 winpos->x, winpos->y, winpos->cx, winpos->cy,
1853 get_winpos_flags(winpos->flags) );
1854
1855 /* Log only documented flags, win2k uses 0x1000 and 0x2000
1856 * in the high word for internal purposes
1857 */
1858 seq->wParam = winpos->flags & 0xffff;
1859 /* We are not interested in the flags that don't match under XP and Win9x */
1860 seq->wParam &= ~SWP_NOZORDER;
1861 break;
1862 }
1863
1864 case WM_DRAWITEM:
1865 {
1866 DRAW_ITEM_STRUCT di;
1867 DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)msg->lParam;
1868
1869 sprintf( seq->output, "%s: %p WM_DRAWITEM: type %x, ctl_id %x, item_id %x, action %x, state %x",
1870 msg->descr, msg->hwnd, dis->CtlType, dis->CtlID,
1871 dis->itemID, dis->itemAction, dis->itemState);
1872
1873 di.u.lp = 0;
1874 di.u.item.type = dis->CtlType;
1875 di.u.item.ctl_id = dis->CtlID;
1876 if (dis->CtlType == ODT_LISTBOX ||
1877 dis->CtlType == ODT_COMBOBOX ||
1878 dis->CtlType == ODT_MENU)
1879 di.u.item.item_id = dis->itemID;
1880 di.u.item.action = dis->itemAction;
1881 di.u.item.state = dis->itemState;
1882
1883 seq->lParam = di.u.lp;
1884 break;
1885 }
1886 default:
1887 if (msg->message >= 0xc000) return; /* ignore registered messages */
1888 sprintf( seq->output, "%s: %p %04x wp %08lx lp %08lx",
1889 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
1890 }
1891 if (msg->flags & (sent|posted|parent|defwinproc|beginpaint))
1892 sprintf( seq->output + strlen(seq->output), " (flags %x)", msg->flags );
1893 }
1894 }
1895
1896 sequence_cnt++;
1897 }
1898
1899 /* try to make sure pending X events have been processed before continuing */
1900 static void flush_events(void)
1901 {
1902 MSG msg;
1903 int diff = 200;
1904 int min_timeout = 100;
1905 DWORD time = GetTickCount() + diff;
1906
1907 while (diff > 0)
1908 {
1909 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
1910 while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
1911 diff = time - GetTickCount();
1912 }
1913 }
1914
1915 static void flush_sequence(void)
1916 {
1917 HeapFree(GetProcessHeap(), 0, sequence);
1918 sequence = 0;
1919 sequence_cnt = sequence_size = 0;
1920 }
1921
1922 static void dump_sequence(const struct message *expected, const char *context, const char *file, int line)
1923 {
1924 const struct recvd_message *actual = sequence;
1925 unsigned int count = 0;
1926
1927 trace_(file, line)("Failed sequence %s:\n", context );
1928 while (expected->message && actual->message)
1929 {
1930 if (actual->output[0])
1931 {
1932 if (expected->flags & hook)
1933 {
1934 trace_(file, line)( " %u: expected: hook %04x - actual: %s\n",
1935 count, expected->message, actual->output );
1936 }
1937 else if (expected->flags & winevent_hook)
1938 {
1939 trace_(file, line)( " %u: expected: winevent %04x - actual: %s\n",
1940 count, expected->message, actual->output );
1941 }
1942 else
1943 {
1944 trace_(file, line)( " %u: expected: msg %04x - actual: %s\n",
1945 count, expected->message, actual->output );
1946 }
1947 }
1948
1949 if (expected->message == actual->message)
1950 {
1951 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) &&
1952 (expected->flags & optional))
1953 {
1954 /* don't match messages if their defwinproc status differs */
1955 expected++;
1956 }
1957 else
1958 {
1959 expected++;
1960 actual++;
1961 }
1962 }
1963 /* silently drop winevent messages if there is no support for them */
1964 else if ((expected->flags & optional) || ((expected->flags & winevent_hook) && !hEvent_hook))
1965 expected++;
1966 else
1967 {
1968 expected++;
1969 actual++;
1970 }
1971 count++;
1972 }
1973
1974 /* optional trailing messages */
1975 while (expected->message && ((expected->flags & optional) ||
1976 ((expected->flags & winevent_hook) && !hEvent_hook)))
1977 {
1978 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
1979 expected++;
1980 count++;
1981 }
1982
1983 if (expected->message)
1984 {
1985 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
1986 return;
1987 }
1988
1989 while (actual->message && actual->output[0])
1990 {
1991 trace_(file, line)( " %u: expected: nothing - actual: %s\n", count, actual->output );
1992 actual++;
1993 count++;
1994 }
1995 }
1996
1997 #define ok_sequence( exp, contx, todo) \
1998 ok_sequence_( (exp), (contx), (todo), __FILE__, __LINE__)
1999
2000
2001 static void ok_sequence_(const struct message *expected_list, const char *context, int todo,
2002 const char *file, int line)
2003 {
2004 static const struct recvd_message end_of_sequence;
2005 const struct message *expected = expected_list;
2006 const struct recvd_message *actual;
2007 int failcount = 0, dump = 0;
2008 unsigned int count = 0;
2009
2010 add_message(&end_of_sequence);
2011
2012 actual = sequence;
2013
2014 while (expected->message && actual->message)
2015 {
2016 if (expected->message == actual->message)
2017 {
2018 if (expected->flags & wparam)
2019 {
2020 if (((expected->wParam ^ actual->wParam) & ~expected->wp_mask) && todo)
2021 {
2022 todo_wine {
2023 failcount ++;
2024 if (strcmp(winetest_platform, "wine")) dump++;
2025 ok_( file, line) (FALSE,
2026 "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
2027 context, count, expected->message, expected->wParam, actual->wParam);
2028 }
2029 }
2030 else
2031 {
2032 ok_( file, line)( ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) == 0,
2033 "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
2034 context, count, expected->message, expected->wParam, actual->wParam);
2035 if ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) dump++;
2036 }
2037
2038 }
2039 if (expected->flags & lparam)
2040 {
2041 if (((expected->lParam ^ actual->lParam) & ~expected->lp_mask) && todo)
2042 {
2043 todo_wine {
2044 failcount ++;
2045 if (strcmp(winetest_platform, "wine")) dump++;
2046 ok_( file, line) (FALSE,
2047 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
2048 context, count, expected->message, expected->lParam, actual->lParam);
2049 }
2050 }
2051 else
2052 {
2053 ok_( file, line)(((expected->lParam ^ actual->lParam) & ~expected->lp_mask) == 0,
2054 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
2055 context, count, expected->message, expected->lParam, actual->lParam);
2056 if ((expected->lParam ^ actual->lParam) & ~expected->lp_mask) dump++;
2057 }
2058 }
2059 if ((expected->flags & optional) &&
2060 ((expected->flags ^ actual->flags) & (defwinproc|parent)))
2061 {
2062 /* don't match optional messages if their defwinproc or parent status differs */
2063 expected++;
2064 count++;
2065 continue;
2066 }
2067 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
2068 {
2069 todo_wine {
2070 failcount ++;
2071 if (strcmp(winetest_platform, "wine")) dump++;
2072 ok_( file, line) (FALSE,
2073 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
2074 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
2075 }
2076 }
2077 else
2078 {
2079 ok_( file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
2080 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
2081 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
2082 if ((expected->flags & defwinproc) != (actual->flags & defwinproc)) dump++;
2083 }
2084
2085 ok_( file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
2086 "%s: %u: the msg 0x%04x should %shave been sent by BeginPaint\n",
2087 context, count, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
2088 if ((expected->flags & beginpaint) != (actual->flags & beginpaint)) dump++;
2089
2090 ok_( file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
2091 "%s: %u: the msg 0x%04x should have been %s\n",
2092 context, count, expected->message, (expected->flags & posted) ? "posted" : "sent");
2093 if ((expected->flags & (sent|posted)) != (actual->flags & (sent|posted))) dump++;
2094
2095 ok_( file, line) ((expected->flags & parent) == (actual->flags & parent),
2096 "%s: %u: the msg 0x%04x was expected in %s\n",
2097 context, count, expected->message, (expected->flags & parent) ? "parent" : "child");
2098 if ((expected->flags & parent) != (actual->flags & parent)) dump++;
2099
2100 ok_( file, line) ((expected->flags & hook) == (actual->flags & hook),
2101 "%s: %u: the msg 0x%04x should have been sent by a hook\n",
2102 context, count, expected->message);
2103 if ((expected->flags & hook) != (actual->flags & hook)) dump++;
2104
2105 ok_( file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
2106 "%s: %u: the msg 0x%04x should have been sent by a winevent hook\n",
2107 context, count, expected->message);
2108 if ((expected->flags & winevent_hook) != (actual->flags & winevent_hook)) dump++;
2109
2110 expected++;
2111 actual++;
2112 }
2113 /* silently drop hook messages if there is no support for them */
2114 else if ((expected->flags & optional) ||
2115 ((expected->flags & hook) && !hCBT_hook) ||
2116 ((expected->flags & winevent_hook) && !hEvent_hook))
2117 expected++;
2118 else if (todo)
2119 {
2120 failcount++;
2121 todo_wine {
2122 if (strcmp(winetest_platform, "wine")) dump++;
2123 ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
2124 context, count, expected->message, actual->message);
2125 }
2126 goto done;
2127 }
2128 else
2129 {
2130 ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
2131 context, count, expected->message, actual->message);
2132 dump++;
2133 expected++;
2134 actual++;
2135 }
2136 count++;
2137 }
2138
2139 /* skip all optional trailing messages */
2140 while (expected->message && ((expected->flags & optional) ||
2141 ((expected->flags & hook) && !hCBT_hook) ||
2142 ((expected->flags & winevent_hook) && !hEvent_hook)))
2143 expected++;
2144
2145 if (todo)
2146 {
2147 todo_wine {
2148 if (expected->message || actual->message) {
2149 failcount++;
2150 if (strcmp(winetest_platform, "wine")) dump++;
2151 ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
2152 context, count, expected->message, actual->message);
2153 }
2154 }
2155 }
2156 else
2157 {
2158 if (expected->message || actual->message)
2159 {
2160 dump++;
2161 ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
2162 context, count, expected->message, actual->message);
2163 }
2164 }
2165 if( todo && !failcount) /* succeeded yet marked todo */
2166 todo_wine {
2167 if (!strcmp(winetest_platform, "wine")) dump++;
2168 ok_( file, line)( TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
2169 }
2170
2171 done:
2172 if (dump) dump_sequence(expected_list, context, file, line);
2173 flush_sequence();
2174 }
2175
2176 #define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
2177
2178 /******************************** MDI test **********************************/
2179
2180 /* CreateWindow for MDI frame window, initially visible */
2181 static const struct message WmCreateMDIframeSeq[] = {
2182 { HCBT_CREATEWND, hook },
2183 { WM_GETMINMAXINFO, sent },
2184 { WM_NCCREATE, sent },
2185 { WM_NCCALCSIZE, sent|wparam, 0 },
2186 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
2187 { WM_CREATE, sent },
2188 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2189 { WM_NOTIFYFORMAT, sent|optional },
2190 { WM_QUERYUISTATE, sent|optional },
2191 { WM_WINDOWPOSCHANGING, sent|optional },
2192 { WM_GETMINMAXINFO, sent|optional },
2193 { WM_NCCALCSIZE, sent|optional },
2194 { WM_WINDOWPOSCHANGED, sent|optional },
2195 { WM_SHOWWINDOW, sent|wparam, 1 },
2196 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2197 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2198 { HCBT_ACTIVATE, hook },
2199 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
2200 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
2201 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* XP */
2202 { WM_ACTIVATEAPP, sent|wparam|optional, 1 }, /* Win9x doesn't send it */
2203 { WM_NCACTIVATE, sent },
2204 { WM_GETTEXT, sent|defwinproc|optional },
2205 { WM_ACTIVATE, sent|wparam, 1 },
2206 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* Win9x */
2207 { HCBT_SETFOCUS, hook },
2208 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2209 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
2210 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2211 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
2212 /* Win9x adds SWP_NOZORDER below */
2213 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2214 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP */
2215 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
2216 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2217 { WM_MOVE, sent },
2218 { 0 }
2219 };
2220 /* DestroyWindow for MDI frame window, initially visible */
2221 static const struct message WmDestroyMDIframeSeq[] = {
2222 { HCBT_DESTROYWND, hook },
2223 { 0x0090, sent|optional },
2224 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2225 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2226 { WM_NCACTIVATE, sent|wparam|optional, 0 }, /* Win9x */
2227 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2228 { WM_NCACTIVATE, sent|wparam|optional, 0 }, /* XP */
2229 { WM_ACTIVATE, sent|wparam|optional, 0 }, /* Win9x */
2230 { WM_ACTIVATEAPP, sent|wparam|optional, 0 }, /* Win9x */
2231 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, OBJID_CARET, 0 },
2232 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2233 { WM_DESTROY, sent },
2234 { WM_NCDESTROY, sent },
2235 { 0 }
2236 };
2237 /* CreateWindow for MDI client window, initially visible */
2238 static const struct message WmCreateMDIclientSeq[] = {
2239 { HCBT_CREATEWND, hook },
2240 { WM_NCCREATE, sent },
2241 { WM_NCCALCSIZE, sent|wparam, 0 },
2242 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2243 { WM_CREATE, sent },
2244 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2245 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2246 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2247 { WM_MOVE, sent },
2248 { WM_PARENTNOTIFY, sent|wparam, WM_CREATE }, /* in MDI frame */
2249 { WM_SHOWWINDOW, sent|wparam, 1 },
2250 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2251 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2252 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2253 { 0 }
2254 };
2255 /* ShowWindow(SW_SHOW) for MDI client window */
2256 static const struct message WmShowMDIclientSeq[] = {
2257 { WM_SHOWWINDOW, sent|wparam, 1 },
2258 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2259 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2260 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2261 { 0 }
2262 };
2263 /* ShowWindow(SW_HIDE) for MDI client window */
2264 static const struct message WmHideMDIclientSeq[] = {
2265 { WM_SHOWWINDOW, sent|wparam, 0 },
2266 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2267 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam|optional, 0, 0 }, /* win2000 */
2268 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP */
2269 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2270 { 0 }
2271 };
2272 /* DestroyWindow for MDI client window, initially visible */
2273 static const struct message WmDestroyMDIclientSeq[] = {
2274 { HCBT_DESTROYWND, hook },
2275 { 0x0090, sent|optional },
2276 { WM_PARENTNOTIFY, sent|wparam, WM_DESTROY }, /* in MDI frame */
2277 { WM_SHOWWINDOW, sent|wparam, 0 },
2278 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2279 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2280 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2281 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2282 { WM_DESTROY, sent },
2283 { WM_NCDESTROY, sent },
2284 { 0 }
2285 };
2286 /* CreateWindow for MDI child window, initially visible */
2287 static const struct message WmCreateMDIchildVisibleSeq[] = {
2288 { HCBT_CREATEWND, hook },
2289 { WM_NCCREATE, sent },
2290 { WM_NCCALCSIZE, sent|wparam, 0 },
2291 { WM_CREATE, sent },
2292 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2293 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2294 { WM_MOVE, sent },
2295 /* Win2k sends wparam set to
2296 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2297 * while Win9x doesn't bother to set child window id according to
2298 * CLIENTCREATESTRUCT.idFirstChild
2299 */
2300 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2301 { WM_SHOWWINDOW, sent|wparam, 1 },
2302 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2303 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2304 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2305 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2306 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2307 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2308 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2309
2310 /* Win9x: message sequence terminates here. */
2311
2312 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2313 { HCBT_SETFOCUS, hook }, /* in MDI client */
2314 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2315 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2316 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2317 { WM_SETFOCUS, sent }, /* in MDI client */
2318 { HCBT_SETFOCUS, hook },
2319 { WM_KILLFOCUS, sent }, /* in MDI client */
2320 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2321 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2322 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2323 { WM_SETFOCUS, sent|defwinproc },
2324 { WM_MDIACTIVATE, sent|defwinproc },
2325 { 0 }
2326 };
2327 /* CreateWindow for MDI child window with invisible parent */
2328 static const struct message WmCreateMDIchildInvisibleParentSeq[] = {
2329 { HCBT_CREATEWND, hook },
2330 { WM_GETMINMAXINFO, sent },
2331 { WM_NCCREATE, sent },
2332 { WM_NCCALCSIZE, sent|wparam, 0 },
2333 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2334 { WM_CREATE, sent },
2335 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2336 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2337 { WM_MOVE, sent },
2338 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2339 { WM_SHOWWINDOW, sent|wparam, 1 },
2340 { WM_MDIREFRESHMENU, sent }, /* in MDI client */
2341 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2342 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2343 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2344
2345 /* Win9x: message sequence terminates here. */
2346
2347 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2348 { HCBT_SETFOCUS, hook }, /* in MDI client */
2349 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2350 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2351 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2352 { WM_SETFOCUS, sent }, /* in MDI client */
2353 { HCBT_SETFOCUS, hook },
2354 { WM_KILLFOCUS, sent }, /* in MDI client */
2355 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2356 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2357 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2358 { WM_SETFOCUS, sent|defwinproc },
2359 { WM_MDIACTIVATE, sent|defwinproc },
2360 { 0 }
2361 };
2362 /* DestroyWindow for MDI child window, initially visible */
2363 static const struct message WmDestroyMDIchildVisibleSeq[] = {
2364 { HCBT_DESTROYWND, hook },
2365 /* Win2k sends wparam set to
2366 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2367 * while Win9x doesn't bother to set child window id according to
2368 * CLIENTCREATESTRUCT.idFirstChild
2369 */
2370 { 0x0090, sent|optional },
2371 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2372 { WM_SHOWWINDOW, sent|wparam, 0 },
2373 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2374 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2375 { WM_ERASEBKGND, sent|parent|optional },
2376 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2377
2378 /* { WM_DESTROY, sent }
2379 * Win9x: message sequence terminates here.
2380 */
2381
2382 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2383 { WM_KILLFOCUS, sent },
2384 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2385 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2386 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2387 { WM_SETFOCUS, sent }, /* in MDI client */
2388
2389 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2390 { WM_KILLFOCUS, sent }, /* in MDI client */
2391 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2392 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2393 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2394 { WM_SETFOCUS, sent }, /* in MDI client */
2395
2396 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2397
2398 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2399 { WM_KILLFOCUS, sent },
2400 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2401 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2402 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2403 { WM_SETFOCUS, sent }, /* in MDI client */
2404
2405 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2406 { WM_KILLFOCUS, sent }, /* in MDI client */
2407 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2408 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2409 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2410 { WM_SETFOCUS, sent }, /* in MDI client */
2411
2412 { WM_DESTROY, sent },
2413
2414 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2415 { WM_KILLFOCUS, sent },
2416 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2417 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2418 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2419 { WM_SETFOCUS, sent }, /* in MDI client */
2420
2421 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2422 { WM_KILLFOCUS, sent }, /* in MDI client */
2423 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2424 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2425 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2426 { WM_SETFOCUS, sent }, /* in MDI client */
2427
2428 { WM_NCDESTROY, sent },
2429 { 0 }
2430 };
2431 /* CreateWindow for MDI child window, initially invisible */
2432 static const struct message WmCreateMDIchildInvisibleSeq[] = {
2433 { HCBT_CREATEWND, hook },
2434 { WM_NCCREATE, sent },
2435 { WM_NCCALCSIZE, sent|wparam, 0 },
2436 { WM_CREATE, sent },
2437 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2438 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2439 { WM_MOVE, sent },
2440 /* Win2k sends wparam set to
2441 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2442 * while Win9x doesn't bother to set child window id according to
2443 * CLIENTCREATESTRUCT.idFirstChild
2444 */
2445 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2446 { 0 }
2447 };
2448 /* DestroyWindow for MDI child window, initially invisible */
2449 static const struct message WmDestroyMDIchildInvisibleSeq[] = {
2450 { HCBT_DESTROYWND, hook },
2451 /* Win2k sends wparam set to
2452 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2453 * while Win9x doesn't bother to set child window id according to
2454 * CLIENTCREATESTRUCT.idFirstChild
2455 */
2456 { 0x0090, sent|optional },
2457 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2458 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2459 { WM_DESTROY, sent },
2460 { WM_NCDESTROY, sent },
2461 /* FIXME: Wine destroys an icon/title window while Windows doesn't */
2462 { WM_PARENTNOTIFY, sent|wparam|optional, WM_DESTROY }, /* MDI client */
2463 { 0 }
2464 };
2465 /* CreateWindow for the 1st MDI child window, initially visible and maximized */
2466 static const struct message WmCreateMDIchildVisibleMaxSeq1[] = {
2467 { HCBT_CREATEWND, hook },
2468 { WM_NCCREATE, sent },
2469 { WM_NCCALCSIZE, sent|wparam, 0 },
2470 { WM_CREATE, sent },
2471 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2472 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2473 { WM_MOVE, sent },
2474 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2475 { WM_GETMINMAXINFO, sent },
2476 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2477 { WM_NCCALCSIZE, sent|wparam, 1 },
2478 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2479 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2480 /* in MDI frame */
2481 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2482 { WM_NCCALCSIZE, sent|wparam, 1 },
2483 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2484 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2485 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2486 /* Win2k sends wparam set to
2487 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2488 * while Win9x doesn't bother to set child window id according to
2489 * CLIENTCREATESTRUCT.idFirstChild
2490 */
2491 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2492 { WM_SHOWWINDOW, sent|wparam, 1 },
2493 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2494 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2495 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2496 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2497 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2498 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2499 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc|optional, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE, 0, SWP_FRAMECHANGED },
2500
2501 /* Win9x: message sequence terminates here. */
2502
2503 { WM_NCACTIVATE, sent|wparam|defwinproc|optional, 1 },
2504 { HCBT_SETFOCUS, hook|optional }, /* in MDI client */
2505 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2506 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2507 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2508 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2509 { HCBT_SETFOCUS, hook|optional },
2510 { WM_KILLFOCUS, sent|optional }, /* in MDI client */
2511 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2512 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2513 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2514 { WM_SETFOCUS, sent|defwinproc|optional },
2515 { WM_MDIACTIVATE, sent|defwinproc|optional },
2516 /* in MDI frame */
2517 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2518 { WM_NCCALCSIZE, sent|wparam, 1 },
2519 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2520 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2521 { 0 }
2522 };
2523 /* CreateWindow for the 2nd MDI child window, initially visible and maximized */
2524 static const struct message WmCreateMDIchildVisibleMaxSeq2[] = {
2525 /* restore the 1st MDI child */
2526 { WM_SETREDRAW, sent|wparam, 0 },
2527 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWNORMAL },
2528 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
2529 { WM_NCCALCSIZE, sent|wparam, 1 },
2530 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2531 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2532 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2533 /* in MDI frame */
2534 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2535 { WM_NCCALCSIZE, sent|wparam, 1 },
2536 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2537 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2538 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2539 { WM_SETREDRAW, sent|wparam, 1 }, /* in the 1st MDI child */
2540 /* create the 2nd MDI child */
2541 { HCBT_CREATEWND, hook },
2542 { WM_NCCREATE, sent },
2543 { WM_NCCALCSIZE, sent|wparam, 0 },
2544 { WM_CREATE, sent },
2545 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2546 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2547 { WM_MOVE, sent },
2548 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2549 { WM_GETMINMAXINFO, sent },
2550 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2551 { WM_NCCALCSIZE, sent|wparam, 1 },
2552 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2553 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2554 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2555 /* in MDI frame */
2556 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2557 { WM_NCCALCSIZE, sent|wparam, 1 },
2558 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2559 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2560 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2561 /* Win2k sends wparam set to
2562 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2563 * while Win9x doesn't bother to set child window id according to
2564 * CLIENTCREATESTRUCT.idFirstChild
2565 */
2566 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2567 { WM_SHOWWINDOW, sent|wparam, 1 },
2568 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2569 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2570 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2571 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2572 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2573 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2574
2575 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
2576 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
2577
2578 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2579
2580 /* Win9x: message sequence terminates here. */
2581
2582 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2583 { HCBT_SETFOCUS, hook },
2584 { WM_KILLFOCUS, sent|defwinproc|optional }, /* in the 1st MDI child */
2585 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 }, /* in the 1st MDI child */
2586 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2587 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2588 { WM_SETFOCUS, sent }, /* in MDI client */
2589 { HCBT_SETFOCUS, hook },
2590 { WM_KILLFOCUS, sent }, /* in MDI client */
2591 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2592 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2593 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2594 { WM_SETFOCUS, sent|defwinproc },
2595
2596 { WM_MDIACTIVATE, sent|defwinproc },
2597 /* in MDI frame */
2598 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2599 { WM_NCCALCSIZE, sent|wparam, 1 },
2600 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2601 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2602 { 0 }
2603 };
2604 /* WM_MDICREATE MDI child window, initially visible and maximized */
2605 static const struct message WmCreateMDIchildVisibleMaxSeq3[] = {
2606 { WM_MDICREATE, sent },
2607 { HCBT_CREATEWND, hook },
2608 { WM_NCCREATE, sent },
2609 { WM_NCCALCSIZE, sent|wparam, 0 },
2610 { WM_CREATE, sent },
2611 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2612 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2613 { WM_MOVE, sent },
2614 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2615 { WM_GETMINMAXINFO, sent },
2616 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2617 { WM_NCCALCSIZE, sent|wparam, 1 },
2618 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2619 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2620
2621 /* in MDI frame */
2622 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2623 { WM_NCCALCSIZE, sent|wparam, 1 },
2624 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2625 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2626 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2627
2628 /* Win2k sends wparam set to
2629 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2630 * while Win9x doesn't bother to set child window id according to
2631 * CLIENTCREATESTRUCT.idFirstChild
2632 */
2633 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2634 { WM_SHOWWINDOW, sent|wparam, 1 },
2635 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2636
2637 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2638
2639 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2640 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2641 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2642
2643 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2644 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2645
2646 /* Win9x: message sequence terminates here. */
2647
2648 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2649 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2650 { HCBT_SETFOCUS, hook }, /* in MDI client */
2651 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2652 { WM_IME_NOTIFY, sent|wparam|optional, 2 },
2653 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
2654 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2655 { HCBT_SETFOCUS, hook|optional },
2656 { WM_KILLFOCUS, sent }, /* in MDI client */
2657 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2658 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2659 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2660 { WM_SETFOCUS, sent|defwinproc },
2661
2662 { WM_MDIACTIVATE, sent|defwinproc },
2663
2664 /* in MDI child */
2665 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2666 { WM_NCCALCSIZE, sent|wparam, 1 },
2667 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2668 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
2669
2670 /* in MDI frame */
2671 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2672 { WM_NCCALCSIZE, sent|wparam, 1 },
2673 { 0x0093, sent|defwinproc|optional },
2674 { 0x0093, sent|defwinproc|optional },
2675 { 0x0093, sent|defwinproc|optional },
2676 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2677 { WM_MOVE, sent|defwinproc },
2678 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2679
2680 /* in MDI client */
2681 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2682 { WM_NCCALCSIZE, sent|wparam, 1 },
2683 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2684 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2685
2686 /* in MDI child */
2687 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2688 { WM_NCCALCSIZE, sent|wparam, 1 },
2689 { 0x0093, sent|optional },
2690 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2691 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2692
2693 { 0x0093, sent|optional },
2694 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2695 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2696 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP sends it to MDI frame */
2697 { 0x0093, sent|defwinproc|optional },
2698 { 0x0093, sent|defwinproc|optional },
2699 { 0x0093, sent|defwinproc|optional },
2700 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2701 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
2702
2703 { 0 }
2704 };
2705 /* CreateWindow for the 1st MDI child window, initially invisible and maximized */
2706 static const struct message WmCreateMDIchildInvisibleMaxSeq4[] = {
2707 { HCBT_CREATEWND, hook },
2708 { WM_GETMINMAXINFO, sent },
2709 { WM_NCCREATE, sent },
2710 { WM_NCCALCSIZE, sent|wparam, 0 },
2711 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
2712 { WM_CREATE, sent },
2713 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2714 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2715 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE, 0, SWP_NOZORDER }, /* MDI frame */
2716 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* MDI frame */
2717 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE, 0, SWP_NOZORDER }, /* MDI frame */
2718 { WM_MOVE, sent },
2719 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2720 { WM_GETMINMAXINFO, sent },
2721 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2722 { WM_GETMINMAXINFO, sent|defwinproc },
2723 { WM_NCCALCSIZE, sent|wparam, 1 },
2724 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_STATECHANGED },
2725 { WM_MOVE, sent|defwinproc },
2726 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2727 /* in MDI frame */
2728 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2729 { WM_NCCALCSIZE, sent|wparam, 1 },
2730 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2731 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2732 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* MDI child */
2733 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2734 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2735 /* Win2k sends wparam set to
2736 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2737 * while Win9x doesn't bother to set child window id according to
2738 * CLIENTCREATESTRUCT.idFirstChild
2739 */
2740 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2741 { 0 }
2742 };
2743 /* WM_SYSCOMMAND/SC_CLOSE for the 2nd MDI child window, initially visible and maximized */
2744 static const struct message WmDestroyMDIchildVisibleMaxSeq2[] = {
2745 { WM_SYSCOMMAND, sent|wparam, SC_CLOSE },
2746 { HCBT_SYSCOMMAND, hook },
2747 { WM_CLOSE, sent|defwinproc },
2748 { WM_MDIDESTROY, sent }, /* in MDI client */
2749
2750 /* bring the 1st MDI child to top */
2751 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOSIZE|SWP_NOMOVE }, /* in the 1st MDI child */
2752 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, /* in the 2nd MDI child */
2753
2754 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2755
2756 { WM_CHILDACTIVATE, sent|defwinproc|wparam|lparam, 0, 0 }, /* in the 1st MDI child */
2757 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
2758 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
2759
2760 /* maximize the 1st MDI child */
2761 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2762 { WM_GETMINMAXINFO, sent|defwinproc },
2763 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_STATECHANGED },
2764 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
2765 { WM_CHILDACTIVATE, sent|defwinproc|wparam|lparam, 0, 0 },
2766 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2767 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2768
2769 /* restore the 2nd MDI child */
2770 { WM_SETREDRAW, sent|defwinproc|wparam, 0 },
2771 { HCBT_MINMAX, hook|lparam, 0, SW_NORMALNA },
2772 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_STATECHANGED },
2773 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
2774
2775 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2776
2777 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2778 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2779
2780 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2781
2782 { WM_SETREDRAW, sent|defwinproc|wparam, 1 },
2783 /* in MDI frame */
2784 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2785 { WM_NCCALCSIZE, sent|wparam, 1 },
2786 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2787 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2788 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2789
2790 /* bring the 1st MDI child to top */
2791 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2792 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2793 { HCBT_SETFOCUS, hook },
2794 { WM_KILLFOCUS, sent|defwinproc },
2795 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 },
2796 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2797 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2798 { WM_SETFOCUS, sent }, /* in MDI client */
2799 { HCBT_SETFOCUS, hook },
2800 { WM_KILLFOCUS, sent }, /* in MDI client */
2801 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2802 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2803 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2804 { WM_SETFOCUS, sent|defwinproc },
2805 { WM_MDIACTIVATE, sent|defwinproc },
2806 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2807
2808 /* apparently ShowWindow(SW_SHOW) on an MDI client */
2809 { WM_SHOWWINDOW, sent|wparam, 1 },
2810 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2811 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2812 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2813 { WM_MDIREFRESHMENU, sent },
2814
2815 { HCBT_DESTROYWND, hook },
2816 /* Win2k sends wparam set to
2817 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2818 * while Win9x doesn't bother to set child window id according to
2819 * CLIENTCREATESTRUCT.idFirstChild
2820 */
2821 { 0x0090, sent|defwinproc|optional },
2822 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2823 { WM_SHOWWINDOW, sent|defwinproc|wparam, 0 },
2824 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2825 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2826 { WM_ERASEBKGND, sent|parent|optional },
2827 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2828
2829 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2830 { WM_DESTROY, sent|defwinproc },
2831 { WM_NCDESTROY, sent|defwinproc },
2832 { 0 }
2833 };
2834 /* WM_MDIDESTROY for the single MDI child window, initially visible and maximized */
2835 static const struct message WmDestroyMDIchildVisibleMaxSeq1[] = {
2836 { WM_MDIDESTROY, sent }, /* in MDI client */
2837 { WM_SHOWWINDOW, sent|wparam, 0 },
2838 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2839 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2840 { WM_ERASEBKGND, sent|parent|optional },
2841 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2842
2843 { HCBT_SETFOCUS, hook },
2844 { WM_KILLFOCUS, sent },
2845 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2846 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2847 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2848 { WM_SETFOCUS, sent }, /* in MDI client */
2849 { HCBT_SETFOCUS, hook },
2850 { WM_KILLFOCUS, sent }, /* in MDI client */
2851 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2852 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2853 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2854 { WM_SETFOCUS, sent },
2855
2856 /* in MDI child */
2857 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2858 { WM_NCCALCSIZE, sent|wparam, 1 },
2859 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2860 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2861
2862 /* in MDI frame */
2863 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2864 { WM_NCCALCSIZE, sent|wparam, 1 },
2865 { 0x0093, sent|defwinproc|optional },
2866 { 0x0093, sent|defwinproc|optional },
2867 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2868 { WM_MOVE, sent|defwinproc },
2869 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2870
2871 /* in MDI client */
2872 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2873 { WM_NCCALCSIZE, sent|wparam, 1 },
2874 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2875 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2876
2877 /* in MDI child */
2878 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2879 { WM_NCCALCSIZE, sent|wparam, 1 },
2880 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE },
2881 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2882
2883 /* in MDI child */
2884 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2885 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2886 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2887 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2888
2889 /* in MDI frame */
2890 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2891 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2892 { 0x0093, sent|defwinproc|optional },
2893 { 0x0093, sent|defwinproc|optional },
2894 { 0x0093, sent|defwinproc|optional },
2895 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2896 { WM_MOVE, sent|defwinproc },
2897 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2898
2899 /* in MDI client */
2900 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2901 { WM_NCCALCSIZE, sent|wparam, 1 },
2902 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2903 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2904
2905 /* in MDI child */
2906 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE },
2907 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2908 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE },
2909 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2910 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2911 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2912
2913 { 0x0093, sent|defwinproc|optional },
2914 { WM_NCCALCSIZE, sent|wparam|defwinproc|optional, 1 }, /* XP sends it to MDI frame */
2915 { 0x0093, sent|defwinproc|optional },
2916 { 0x0093, sent|defwinproc|optional },
2917 { 0x0093, sent|defwinproc|optional },
2918 { 0x0093, sent|optional },
2919
2920 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2921 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2922 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2923 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2924 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
2925
2926 /* in MDI frame */
2927 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2928 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
2929 { 0x0093, sent|defwinproc|optional },
2930 { 0x0093, sent|defwinproc|optional },
2931 { 0x0093, sent|defwinproc|optional },
2932 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2933 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2934 { 0x0093, sent|optional },
2935
2936 { WM_NCACTIVATE, sent|wparam, 0 },
2937 { WM_MDIACTIVATE, sent },
2938
2939 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWNORMAL },
2940 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_STATECHANGED },
2941 { WM_NCCALCSIZE, sent|wparam, 1 },
2942
2943 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2944
2945 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2946 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2947 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2948
2949 /* in MDI child */
2950 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2951 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2952 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2953 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2954
2955 /* in MDI frame */
2956 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2957 { WM_NCCALCSIZE, sent|wparam, 1 },
2958 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2959 { WM_MOVE, sent|defwinproc },
2960 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2961
2962 /* in MDI client */
2963 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2964 { WM_NCCALCSIZE, sent|wparam, 1 },
2965 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2966 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2967 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2968 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP */
2969 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2970 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2971 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
2972
2973 { HCBT_SETFOCUS, hook },
2974 { WM_KILLFOCUS, sent },
2975 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2976 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2977 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2978 { WM_SETFOCUS, sent }, /* in MDI client */
2979
2980 { WM_MDIREFRESHMENU, sent }, /* in MDI client */
2981
2982 { HCBT_DESTROYWND, hook },
2983 /* Win2k sends wparam set to
2984 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2985 * while Win9x doesn't bother to set child window id according to
2986 * CLIENTCREATESTRUCT.idFirstChild
2987 */
2988 { 0x0090, sent|optional },
2989 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2990
2991 { WM_SHOWWINDOW, sent|wparam, 0 },
2992 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2993 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2994 { WM_ERASEBKGND, sent|parent|optional },
2995 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2996
2997 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2998 { WM_DESTROY, sent },
2999 { WM_NCDESTROY, sent },
3000 { 0 }
3001 };
3002 /* ShowWindow(SW_MAXIMIZE) for a not visible MDI child window */
3003 static const struct message WmMaximizeMDIchildInvisibleSeq[] = {
3004 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
3005 { WM_GETMINMAXINFO, sent },
3006 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
3007 { WM_NCCALCSIZE, sent|wparam, 1 },
3008 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
3009 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
3010
3011 { WM_WINDOWPOSCHANGING, sent|wparam|optional|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
3012 { WM_NCACTIVATE, sent|wparam|optional|defwinproc, 1 },
3013 { HCBT_SETFOCUS, hook|optional },
3014 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
3015 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
3016 { WM_SETFOCUS, sent|optional }, /* in MDI client */
3017 { HCBT_SETFOCUS, hook|optional },
3018 { WM_KILLFOCUS