bfc81dcf5e97d8d803c3986cf8b760640843a4c3
[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|wparam, 1 },
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, /*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, 0 },
635 { WM_ACTIVATE, sent|wparam, 0 },
636 { WM_ACTIVATEAPP, sent|wparam, 0 },
637 { WM_KILLFOCUS, sent|wparam, 0 },
638 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
639 { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
640 { 0 }
641 };
642 /* DestroyWindow for a visible overlapped window */
643 static const struct message WmDestroyOverlappedSeq[] = {
644 { HCBT_DESTROYWND, hook },
645 { 0x0090, sent|optional },
646 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
647 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
648 { 0x0090, sent|optional },
649 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
650 { WM_NCACTIVATE, sent|optional|wparam, 0 },
651 { WM_ACTIVATE, sent|optional },
652 { WM_ACTIVATEAPP, sent|optional|wparam, 0 },
653 { WM_KILLFOCUS, sent|optional|wparam, 0 },
654 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
655 { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
656 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
657 { WM_DESTROY, sent },
658 { WM_NCDESTROY, sent },
659 { 0 }
660 };
661 /* CreateWindow(WS_MAXIMIZE|WS_VISIBLE) for popup window */
662 static const struct message WmCreateMaxPopupSeq[] = {
663 { HCBT_CREATEWND, hook },
664 { WM_NCCREATE, sent },
665 { WM_NCCALCSIZE, sent|wparam, 0 },
666 { WM_CREATE, sent },
667 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
668 { WM_SIZE, sent|wparam, SIZE_RESTORED },
669 { WM_MOVE, sent },
670 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
671 { WM_GETMINMAXINFO, sent },
672 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },
673 { WM_NCCALCSIZE, sent|wparam, TRUE },
674 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_STATECHANGED },
675 { WM_MOVE, sent|defwinproc },
676 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
677 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
678 { WM_SHOWWINDOW, sent|wparam, 1 },
679 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
680 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
681 { HCBT_ACTIVATE, hook },
682 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
683 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
684 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
685 { WM_NCPAINT, sent|wparam|optional, 1 },
686 { WM_ERASEBKGND, sent|optional },
687 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_NOMOVE|SWP_NOSIZE },
688 { WM_ACTIVATEAPP, sent|wparam, 1 },
689 { WM_NCACTIVATE, sent },
690 { WM_ACTIVATE, sent|wparam, 1 },
691 { HCBT_SETFOCUS, hook },
692 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
693 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
694 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
695 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
696 { WM_GETTEXT, sent|optional },
697 { WM_SYNCPAINT, sent|wparam|optional, 4 },
698 { WM_NCPAINT, sent|wparam|optional, 1 },
699 { WM_ERASEBKGND, sent|optional },
700 { WM_NCPAINT, sent|wparam|defwinproc|optional, 1 },
701 { WM_ERASEBKGND, sent|defwinproc|optional },
702 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE },
703 { 0 }
704 };
705 /* CreateWindow(WS_MAXIMIZE) for popup window, not initially visible */
706 static const struct message WmCreateInvisibleMaxPopupSeq[] = {
707 { HCBT_CREATEWND, hook },
708 { WM_NCCREATE, sent },
709 { WM_NCCALCSIZE, sent|wparam, 0 },
710 { WM_CREATE, sent },
711 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
712 { WM_SIZE, sent|wparam, SIZE_RESTORED },
713 { WM_MOVE, sent },
714 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
715 { WM_GETMINMAXINFO, sent },
716 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },
717 { WM_NCCALCSIZE, sent|wparam, TRUE },
718 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_STATECHANGED },
719 { WM_MOVE, sent|defwinproc },
720 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
721 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
722 { 0 }
723 };
724 /* ShowWindow(SW_SHOWMAXIMIZED) for a resized not visible popup window */
725 static const struct message WmShowMaxPopupResizedSeq[] = {
726 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
727 { WM_GETMINMAXINFO, sent },
728 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED },
729 { WM_NCCALCSIZE, sent|wparam, TRUE },
730 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
731 { HCBT_ACTIVATE, hook },
732 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
733 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
734 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
735 { WM_NCPAINT, sent|wparam|optional, 1 },
736 { WM_ERASEBKGND, sent|optional },
737 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
738 { WM_ACTIVATEAPP, sent|wparam, 1 },
739 { WM_NCACTIVATE, sent },
740 { WM_ACTIVATE, sent|wparam, 1 },
741 { HCBT_SETFOCUS, hook },
742 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
743 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
744 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
745 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
746 { WM_GETTEXT, sent|optional },
747 { WM_NCPAINT, sent|wparam|optional, 1 },
748 { WM_ERASEBKGND, sent|optional },
749 { WM_WINDOWPOSCHANGED, sent },
750 /* WinNT4.0 sends WM_MOVE */
751 { WM_MOVE, sent|defwinproc|optional },
752 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
753 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
754 { 0 }
755 };
756 /* ShowWindow(SW_SHOWMAXIMIZED) for a not visible popup window */
757 static const struct message WmShowMaxPopupSeq[] = {
758 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
759 { WM_GETMINMAXINFO, sent },
760 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED },
761 { WM_NCCALCSIZE, sent|wparam, TRUE },
762 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
763 { HCBT_ACTIVATE, hook },
764 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
765 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
766 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
767 { WM_ACTIVATEAPP, sent|wparam, 1 },
768 { WM_NCACTIVATE, sent },
769 { WM_ACTIVATE, sent|wparam, 1 },
770 { HCBT_SETFOCUS, hook },
771 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
772 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
773 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
774 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
775 { WM_GETTEXT, sent|optional },
776 { WM_SYNCPAINT, sent|wparam|optional, 4 },
777 { WM_NCPAINT, sent|wparam|optional, 1 },
778 { WM_ERASEBKGND, sent|optional },
779 { WM_NCPAINT, sent|wparam|defwinproc|optional, 1 },
780 { WM_ERASEBKGND, sent|defwinproc|optional },
781 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE },
782 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
783 { 0 }
784 };
785 /* CreateWindow(WS_VISIBLE) for popup window */
786 static const struct message WmCreatePopupSeq[] = {
787 { HCBT_CREATEWND, hook },
788 { WM_NCCREATE, sent },
789 { WM_NCCALCSIZE, sent|wparam, 0 },
790 { WM_CREATE, sent },
791 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
792 { WM_SIZE, sent|wparam, SIZE_RESTORED },
793 { WM_MOVE, sent },
794 { WM_SHOWWINDOW, sent|wparam, 1 },
795 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
796 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
797 { HCBT_ACTIVATE, hook },
798 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
799 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
800 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
801 { WM_NCPAINT, sent|wparam|optional, 1 },
802 { WM_ERASEBKGND, sent|optional },
803 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
804 { WM_ACTIVATEAPP, sent|wparam, 1 },
805 { WM_NCACTIVATE, sent },
806 { WM_ACTIVATE, sent|wparam, 1 },
807 { HCBT_SETFOCUS, hook },
808 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
809 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
810 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
811 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
812 { WM_GETTEXT, sent|optional },
813 { WM_SYNCPAINT, sent|wparam|optional, 4 },
814 { WM_NCPAINT, sent|wparam|optional, 1 },
815 { WM_ERASEBKGND, sent|optional },
816 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE },
817 { 0 }
818 };
819 /* ShowWindow(SW_SHOWMAXIMIZED) for a visible popup window */
820 static const struct message WmShowVisMaxPopupSeq[] = {
821 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
822 { WM_GETMINMAXINFO, sent },
823 { WM_GETTEXT, sent|optional },
824 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
825 { WM_GETTEXT, sent|optional },
826 { WM_NCCALCSIZE, sent|wparam, TRUE },
827 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
828 { WM_NCPAINT, sent|wparam|optional, 1 },
829 { WM_ERASEBKGND, sent|optional },
830 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
831 { WM_MOVE, sent|defwinproc },
832 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
833 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
834 { 0 }
835 };
836 /* CreateWindow (for a child popup window, not initially visible) */
837 static const struct message WmCreateChildPopupSeq[] = {
838 { HCBT_CREATEWND, hook },
839 { WM_NCCREATE, sent },
840 { WM_NCCALCSIZE, sent|wparam, 0 },
841 { WM_CREATE, sent },
842 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
843 { WM_SIZE, sent|wparam, SIZE_RESTORED },
844 { WM_MOVE, sent },
845 { 0 }
846 };
847 /* CreateWindow (for a popup window, not initially visible,
848 * which sets WS_VISIBLE in WM_CREATE handler)
849 */
850 static const struct message WmCreateInvisiblePopupSeq[] = {
851 { HCBT_CREATEWND, hook },
852 { WM_NCCREATE, sent },
853 { WM_NCCALCSIZE, sent|wparam, 0 },
854 { WM_CREATE, sent },
855 { WM_STYLECHANGING, sent },
856 { WM_STYLECHANGED, sent },
857 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
858 { WM_SIZE, sent|wparam, SIZE_RESTORED },
859 { WM_MOVE, sent },
860 { 0 }
861 };
862 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER)
863 * for a popup window with WS_VISIBLE style set
864 */
865 static const struct message WmShowVisiblePopupSeq_2[] = {
866 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
867 { 0 }
868 };
869 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
870 * for a popup window with WS_VISIBLE style set
871 */
872 static const struct message WmShowVisiblePopupSeq_3[] = {
873 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
874 { HCBT_ACTIVATE, hook },
875 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
876 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
877 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
878 { WM_NCACTIVATE, sent },
879 { WM_ACTIVATE, sent|wparam, 1 },
880 { HCBT_SETFOCUS, hook },
881 { WM_KILLFOCUS, sent|parent },
882 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
883 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
884 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
885 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
886 { WM_SETFOCUS, sent|defwinproc },
887 { WM_GETTEXT, sent|optional },
888 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE, 0, SWP_SHOWWINDOW },
889 { 0 }
890 };
891 /* CreateWindow (for child window, not initially visible) */
892 static const struct message WmCreateChildSeq[] = {
893 { HCBT_CREATEWND, hook },
894 { WM_NCCREATE, sent },
895 /* child is inserted into parent's child list after WM_NCCREATE returns */
896 { WM_NCCALCSIZE, sent|wparam, 0 },
897 { WM_CREATE, sent },
898 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
899 { WM_SIZE, sent|wparam, SIZE_RESTORED },
900 { WM_MOVE, sent },
901 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
902 { 0 }
903 };
904 /* CreateWindow (for maximized child window, not initially visible) */
905 static const struct message WmCreateMaximizedChildSeq[] = {
906 { HCBT_CREATEWND, hook },
907 { WM_NCCREATE, sent },
908 { WM_NCCALCSIZE, sent|wparam, 0 },
909 { WM_CREATE, sent },
910 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
911 { WM_SIZE, sent|wparam, SIZE_RESTORED },
912 { WM_MOVE, sent },
913 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
914 { WM_GETMINMAXINFO, sent },
915 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
916 { WM_NCCALCSIZE, sent|wparam, 1 },
917 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
918 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
919 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
920 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
921 { 0 }
922 };
923 /* CreateWindow (for a child window, initially visible) */
924 static const struct message WmCreateVisibleChildSeq[] = {
925 { HCBT_CREATEWND, hook },
926 { WM_NCCREATE, sent },
927 /* child is inserted into parent's child list after WM_NCCREATE returns */
928 { WM_NCCALCSIZE, sent|wparam, 0 },
929 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
930 { WM_CREATE, sent },
931 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
932 { WM_SIZE, sent|wparam, SIZE_RESTORED },
933 { WM_MOVE, sent },
934 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
935 { WM_SHOWWINDOW, sent|wparam, 1 },
936 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
937 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
938 { WM_ERASEBKGND, sent|parent|optional },
939 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
940 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* WinXP */
941 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
942 { 0 }
943 };
944 /* ShowWindow(SW_SHOW) for a not visible child window */
945 static const struct message WmShowChildSeq[] = {
946 { WM_SHOWWINDOW, sent|wparam, 1 },
947 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
948 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
949 { WM_ERASEBKGND, sent|parent|optional },
950 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
951 { 0 }
952 };
953 /* ShowWindow(SW_HIDE) for a visible child window */
954 static const struct message WmHideChildSeq[] = {
955 { WM_SHOWWINDOW, sent|wparam, 0 },
956 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
957 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
958 { WM_ERASEBKGND, sent|parent|optional },
959 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
960 { 0 }
961 };
962 /* ShowWindow(SW_HIDE) for a visible child window checking all parent events*/
963 static const struct message WmHideChildSeq2[] = {
964 { WM_SHOWWINDOW, sent|wparam, 0 },
965 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
966 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
967 { WM_ERASEBKGND, sent|parent|optional },
968 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
969 { 0 }
970 };
971 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
972 * for a not visible child window
973 */
974 static const struct message WmShowChildSeq_2[] = {
975 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
976 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
977 { WM_CHILDACTIVATE, sent },
978 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
979 { 0 }
980 };
981 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE)
982 * for a not visible child window
983 */
984 static const struct message WmShowChildSeq_3[] = {
985 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
986 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
987 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
988 { 0 }
989 };
990 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
991 * for a visible child window with a caption
992 */
993 static const struct message WmShowChildSeq_4[] = {
994 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
995 { WM_CHILDACTIVATE, sent },
996 { 0 }
997 };
998 /* ShowWindow(SW_MINIMIZE) for child with invisible parent */
999 static const struct message WmShowChildInvisibleParentSeq_1[] = {
1000 { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
1001 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
1002 { WM_NCCALCSIZE, sent|wparam, 1 },
1003 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1004 { WM_CHILDACTIVATE, sent|optional },
1005 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
1006 { WM_MOVE, sent|defwinproc },
1007 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1008 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1009 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1010 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1011 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1012 { WM_GETTEXT, sent|optional },
1013 { 0 }
1014 };
1015 /* repeated ShowWindow(SW_MINIMIZE) for child with invisible parent */
1016 static const struct message WmShowChildInvisibleParentSeq_1r[] = {
1017 { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
1018 { 0 }
1019 };
1020 /* ShowWindow(SW_MAXIMIZE) for child with invisible parent */
1021 static const struct message WmShowChildInvisibleParentSeq_2[] = {
1022 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
1023 { WM_GETMINMAXINFO, sent },
1024 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
1025 { WM_NCCALCSIZE, sent|wparam, 1 },
1026 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1027 { WM_CHILDACTIVATE, sent },
1028 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
1029 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
1030 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1031 { 0 }
1032 };
1033 /* repeated ShowWindow(SW_MAXIMIZE) for child with invisible parent */
1034 static const struct message WmShowChildInvisibleParentSeq_2r[] = {
1035 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
1036 { 0 }
1037 };
1038 /* ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
1039 static const struct message WmShowChildInvisibleParentSeq_3[] = {
1040 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINIMIZED },
1041 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
1042 { WM_NCCALCSIZE, sent|wparam, 1 },
1043 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1044 { WM_CHILDACTIVATE, sent },
1045 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED },
1046 { WM_MOVE, sent|defwinproc },
1047 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1048 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1049 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1050 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1051 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1052 { WM_GETTEXT, sent|optional },
1053 { 0 }
1054 };
1055 /* repeated ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
1056 static const struct message WmShowChildInvisibleParentSeq_3r[] = {
1057 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINIMIZED },
1058 { 0 }
1059 };
1060 /* ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
1061 static const struct message WmShowChildInvisibleParentSeq_4[] = {
1062 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINNOACTIVE },
1063 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_STATECHANGED },
1064 { WM_NCCALCSIZE, sent|wparam, 1 },
1065 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1066 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED },
1067 { WM_MOVE, sent|defwinproc },
1068 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1069 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1070 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1071 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1072 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1073 { WM_GETTEXT, sent|optional },
1074 { 0 }
1075 };
1076 /* repeated ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
1077 static const struct message WmShowChildInvisibleParentSeq_4r[] = {
1078 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINNOACTIVE },
1079 { 0 }
1080 };
1081 /* ShowWindow(SW_SHOW) for child with invisible parent */
1082 static const struct message WmShowChildInvisibleParentSeq_5[] = {
1083 { WM_SHOWWINDOW, sent|wparam, 1 },
1084 { 0 }
1085 };
1086 /* ShowWindow(SW_HIDE) for child with invisible parent */
1087 static const struct message WmHideChildInvisibleParentSeq[] = {
1088 { WM_SHOWWINDOW, sent|wparam, 0 },
1089 { 0 }
1090 };
1091 /* SetWindowPos(SWP_SHOWWINDOW) for child with invisible parent */
1092 static const struct message WmShowChildInvisibleParentSeq_6[] = {
1093 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1094 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1095 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1096 { 0 }
1097 };
1098 /* SetWindowPos(SWP_HIDEWINDOW) for child with invisible parent */
1099 static const struct message WmHideChildInvisibleParentSeq_2[] = {
1100 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1101 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1102 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1103 { 0 }
1104 };
1105 /* DestroyWindow for a visible child window */
1106 static const struct message WmDestroyChildSeq[] = {
1107 { HCBT_DESTROYWND, hook },
1108 { 0x0090, sent|optional },
1109 { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY },
1110 { WM_SHOWWINDOW, sent|wparam, 0 },
1111 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1112 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1113 { WM_ERASEBKGND, sent|parent|optional },
1114 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1115 { HCBT_SETFOCUS, hook }, /* set focus to a parent */
1116 { WM_KILLFOCUS, sent },
1117 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
1118 { WM_IME_SETCONTEXT, sent|wparam|parent|optional, 1 },
1119 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1120 { WM_SETFOCUS, sent|parent },
1121 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1122 { WM_DESTROY, sent },
1123 { WM_DESTROY, sent|optional }, /* some other (IME?) window */
1124 { WM_NCDESTROY, sent|optional }, /* some other (IME?) window */
1125 { WM_NCDESTROY, sent },
1126 { 0 }
1127 };
1128 /* visible child window destroyed by thread exit */
1129 static const struct message WmExitThreadSeq[] = {
1130 { WM_NCDESTROY, sent }, /* actually in grandchild */
1131 { WM_PAINT, sent|parent },
1132 { WM_ERASEBKGND, sent|parent|beginpaint },
1133 { 0 }
1134 };
1135 /* DestroyWindow for a visible child window with invisible parent */
1136 static const struct message WmDestroyInvisibleChildSeq[] = {
1137 { HCBT_DESTROYWND, hook },
1138 { 0x0090, sent|optional },
1139 { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY },
1140 { WM_SHOWWINDOW, sent|wparam, 0 },
1141 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1142 { WM_DESTROY, sent },
1143 { WM_NCDESTROY, sent },
1144 { 0 }
1145 };
1146 /* Moving the mouse in nonclient area */
1147 static const struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */
1148 { WM_NCHITTEST, sent },
1149 { WM_SETCURSOR, sent },
1150 { WM_NCMOUSEMOVE, posted },
1151 { 0 }
1152 };
1153 /* Moving the mouse in client area */
1154 static const struct message WmMouseMoveInClientAreaSeq[] = { /* FIXME: add */
1155 { WM_NCHITTEST, sent },
1156 { WM_SETCURSOR, sent },
1157 { WM_MOUSEMOVE, posted },
1158 { 0 }
1159 };
1160 /* Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
1161 static const struct message WmDragTitleBarSeq[] = { /* FIXME: add */
1162 { WM_NCLBUTTONDOWN, sent|wparam, HTCAPTION },
1163 { WM_SYSCOMMAND, sent|defwinproc|wparam, SC_MOVE+2 },
1164 { WM_GETMINMAXINFO, sent|defwinproc },
1165 { WM_ENTERSIZEMOVE, sent|defwinproc },
1166 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, 0 },
1167 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, 0 },
1168 { WM_MOVE, sent|defwinproc },
1169 { WM_EXITSIZEMOVE, sent|defwinproc },
1170 { 0 }
1171 };
1172 /* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
1173 static const struct message WmDragThickBordersBarSeq[] = { /* FIXME: add */
1174 { WM_NCLBUTTONDOWN, sent|wparam, 0xd },
1175 { WM_SYSCOMMAND, sent|defwinproc|wparam, 0xf004 },
1176 { WM_GETMINMAXINFO, sent|defwinproc },
1177 { WM_ENTERSIZEMOVE, sent|defwinproc },
1178 { WM_SIZING, sent|defwinproc|wparam, 4}, /* one for each mouse movement */
1179 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, 0 },
1180 { WM_GETMINMAXINFO, sent|defwinproc },
1181 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
1182 { WM_NCPAINT, sent|defwinproc|wparam, 1 },
1183 { WM_GETTEXT, sent|defwinproc },
1184 { WM_ERASEBKGND, sent|defwinproc },
1185 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, 0 },
1186 { WM_MOVE, sent|defwinproc },
1187 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1188 { WM_EXITSIZEMOVE, sent|defwinproc },
1189 { 0 }
1190 };
1191 /* Resizing child window with MoveWindow (32) */
1192 static const struct message WmResizingChildWithMoveWindowSeq[] = {
1193 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
1194 { WM_NCCALCSIZE, sent|wparam, 1 },
1195 { WM_ERASEBKGND, sent|parent|optional },
1196 { WM_ERASEBKGND, sent|optional },
1197 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE },
1198 { WM_MOVE, sent|defwinproc },
1199 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1200 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1201 { 0 }
1202 };
1203 /* Clicking on inactive button */
1204 static const struct message WmClickInactiveButtonSeq[] = { /* FIXME: add */
1205 { WM_NCHITTEST, sent },
1206 { WM_PARENTNOTIFY, sent|parent|wparam, WM_LBUTTONDOWN },
1207 { WM_MOUSEACTIVATE, sent },
1208 { WM_MOUSEACTIVATE, sent|parent|defwinproc },
1209 { WM_SETCURSOR, sent },
1210 { WM_SETCURSOR, sent|parent|defwinproc },
1211 { WM_LBUTTONDOWN, posted },
1212 { WM_KILLFOCUS, posted|parent },
1213 { WM_SETFOCUS, posted },
1214 { WM_CTLCOLORBTN, posted|parent },
1215 { BM_SETSTATE, posted },
1216 { WM_CTLCOLORBTN, posted|parent },
1217 { WM_LBUTTONUP, posted },
1218 { BM_SETSTATE, posted },
1219 { WM_CTLCOLORBTN, posted|parent },
1220 { WM_COMMAND, posted|parent },
1221 { 0 }
1222 };
1223 /* Reparenting a button (16/32) */
1224 /* The last child (button) reparented gets topmost for its new parent. */
1225 static const struct message WmReparentButtonSeq[] = { /* FIXME: add */
1226 { WM_SHOWWINDOW, sent|wparam, 0 },
1227 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1228 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1229 { WM_ERASEBKGND, sent|parent },
1230 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1231 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE },
1232 { WM_CHILDACTIVATE, sent },
1233 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOREDRAW },
1234 { WM_MOVE, sent|defwinproc },
1235 { WM_SHOWWINDOW, sent|wparam, 1 },
1236 { 0 }
1237 };
1238 /* Creation of a custom dialog (32) */
1239 static const struct message WmCreateCustomDialogSeq[] = {
1240 { HCBT_CREATEWND, hook },
1241 { WM_GETMINMAXINFO, sent },
1242 { WM_NCCREATE, sent },
1243 { WM_NCCALCSIZE, sent|wparam, 0 },
1244 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1245 { WM_CREATE, sent },
1246 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1247 { WM_NOTIFYFORMAT, sent|optional },
1248 { WM_QUERYUISTATE, sent|optional },
1249 { WM_WINDOWPOSCHANGING, sent|optional },
1250 { WM_GETMINMAXINFO, sent|optional },
1251 { WM_NCCALCSIZE, sent|optional },
1252 { WM_WINDOWPOSCHANGED, sent|optional },
1253 { WM_SHOWWINDOW, sent|wparam, 1 },
1254 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
1255 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1256 { HCBT_ACTIVATE, hook },
1257 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1258
1259
1260 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1261
1262 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
1263
1264 { WM_NCACTIVATE, sent },
1265 { WM_GETTEXT, sent|optional|defwinproc },
1266 { WM_GETTEXT, sent|optional|defwinproc },
1267 { WM_GETTEXT, sent|optional|defwinproc },
1268 { EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
1269 { WM_ACTIVATE, sent|wparam, 1 },
1270 { WM_GETTEXT, sent|optional },
1271 { WM_KILLFOCUS, sent|parent },
1272 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1273 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
1274 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
1275 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1276 { WM_SETFOCUS, sent },
1277 { WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
1278 { WM_NCPAINT, sent|wparam, 1 },
1279 { WM_GETTEXT, sent|optional|defwinproc },
1280 { WM_GETTEXT, sent|optional|defwinproc },
1281 { WM_ERASEBKGND, sent },
1282 { WM_CTLCOLORDLG, sent|optional|defwinproc },
1283 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1284 { WM_GETTEXT, sent|optional },
1285 { WM_GETTEXT, sent|optional },
1286 { WM_NCCALCSIZE, sent|optional },
1287 { WM_NCPAINT, sent|optional },
1288 { WM_GETTEXT, sent|optional|defwinproc },
1289 { WM_GETTEXT, sent|optional|defwinproc },
1290 { WM_ERASEBKGND, sent|optional },
1291 { WM_CTLCOLORDLG, sent|optional|defwinproc },
1292 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1293 { WM_SIZE, sent|wparam, SIZE_RESTORED },
1294 { WM_MOVE, sent },
1295 { 0 }
1296 };
1297 /* Calling EndDialog for a custom dialog (32) */
1298 static const struct message WmEndCustomDialogSeq[] = {
1299 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1300 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1301 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1302 { WM_GETTEXT, sent|optional },
1303 { HCBT_ACTIVATE, hook },
1304 { WM_NCACTIVATE, sent|wparam, 0 },
1305 { WM_GETTEXT, sent|optional|defwinproc },
1306 { WM_GETTEXT, sent|optional|defwinproc },
1307 { WM_ACTIVATE, sent|wparam, 0 },
1308 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1309 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1310 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1311 { WM_GETTEXT, sent|optional|defwinproc },
1312 { WM_GETTEXT, sent|optional|defwinproc },
1313 { HCBT_SETFOCUS, hook },
1314 { WM_KILLFOCUS, sent },
1315 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
1316 { WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 },
1317 { WM_IME_NOTIFY, sent|wparam|optional, 1 },
1318 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1319 { WM_SETFOCUS, sent|parent|defwinproc },
1320 { 0 }
1321 };
1322 /* ShowWindow(SW_SHOW) for a custom dialog (initially invisible) */
1323 static const struct message WmShowCustomDialogSeq[] = {
1324 { WM_SHOWWINDOW, sent|wparam, 1 },
1325 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
1326 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1327 { HCBT_ACTIVATE, hook },
1328 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1329
1330 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1331
1332 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
1333 { WM_ACTIVATEAPP, sent|wparam|optional, 1 },
1334 { WM_NCACTIVATE, sent },
1335 { WM_ACTIVATE, sent|wparam, 1 },
1336 { WM_GETTEXT, sent|optional },
1337
1338 { WM_KILLFOCUS, sent|parent },
1339 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1340 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
1341 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
1342 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1343 { WM_SETFOCUS, sent },
1344 { WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
1345 { WM_NCPAINT, sent|wparam, 1 },
1346 { WM_ERASEBKGND, sent },
1347 { WM_CTLCOLORDLG, sent|defwinproc },
1348 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1349 { 0 }
1350 };
1351 /* Creation and destruction of a modal dialog (32) */
1352 static const struct message WmModalDialogSeq[] = {
1353 { WM_CANCELMODE, sent|parent },
1354 { HCBT_SETFOCUS, hook },
1355 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1356 { WM_KILLFOCUS, sent|parent },
1357 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1358 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1359 { WM_ENABLE, sent|parent|wparam, 0 },
1360 { HCBT_CREATEWND, hook },
1361 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1362 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1363 { WM_SETFONT, sent },
1364 { WM_INITDIALOG, sent },
1365 { WM_CHANGEUISTATE, sent|optional },
1366 { WM_UPDATEUISTATE, sent|optional },
1367 { WM_SHOWWINDOW, sent },
1368 { HCBT_ACTIVATE, hook },
1369 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1370 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1371 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOMOVE },
1372 { WM_NCACTIVATE, sent },
1373 { WM_GETTEXT, sent|optional },
1374 { WM_ACTIVATE, sent|wparam, 1 },
1375 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1376 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1377 { WM_NCPAINT, sent|optional },
1378 { WM_GETTEXT, sent|optional },
1379 { WM_ERASEBKGND, sent|optional },
1380 { WM_CTLCOLORDLG, sent|optional },
1381 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1382 { WM_GETTEXT, sent|optional },
1383 { WM_NCCALCSIZE, sent|optional },
1384 { WM_NCPAINT, sent|optional },
1385 { WM_GETTEXT, sent|optional },
1386 { WM_ERASEBKGND, sent|optional },
1387 { WM_CTLCOLORDLG, sent|optional },
1388 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1389 { WM_PAINT, sent|optional },
1390 { WM_CTLCOLORBTN, sent|optional },
1391 { WM_GETTITLEBARINFOEX, sent|optional },
1392 { WM_ENTERIDLE, sent|parent|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_TIMER, sent },
1413 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1414 { WM_ENABLE, sent|parent|wparam, 1 },
1415 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1416 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1417 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1418 { WM_GETTEXT, sent|optional },
1419 { HCBT_ACTIVATE, hook },
1420 { WM_NCACTIVATE, sent|wparam, 0 },
1421 { WM_GETTEXT, sent|optional },
1422 { WM_ACTIVATE, sent|wparam, 0 },
1423 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1424 { WM_WINDOWPOSCHANGING, sent|optional },
1425 { WM_WINDOWPOSCHANGED, sent|optional },
1426 { HCBT_SETFOCUS, hook },
1427 { WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 },
1428 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1429 { WM_SETFOCUS, sent|parent|defwinproc },
1430 { EVENT_SYSTEM_DIALOGEND, winevent_hook|wparam|lparam, 0, 0 },
1431 { HCBT_DESTROYWND, hook },
1432 { 0x0090, sent|optional },
1433 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1434 { WM_DESTROY, sent },
1435 { WM_NCDESTROY, sent },
1436 { 0 }
1437 };
1438 /* Creation of a modal dialog that is resized inside WM_INITDIALOG (32) */
1439 static const struct message WmCreateModalDialogResizeSeq[] = { /* FIXME: add */
1440 /* (inside dialog proc, handling WM_INITDIALOG) */
1441 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1442 { WM_NCCALCSIZE, sent },
1443 { WM_NCACTIVATE, sent|parent|wparam, 0 },
1444 { WM_GETTEXT, sent|defwinproc },
1445 { WM_ACTIVATE, sent|parent|wparam, 0 },
1446 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1447 { WM_WINDOWPOSCHANGING, sent|parent },
1448 { WM_NCACTIVATE, sent|wparam, 1 },
1449 { WM_ACTIVATE, sent|wparam, 1 },
1450 { WM_WINDOWPOSCHANGED, sent|wparam, 0 },
1451 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1452 /* (setting focus) */
1453 { WM_SHOWWINDOW, sent|wparam, 1 },
1454 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1455 { WM_NCPAINT, sent },
1456 { WM_GETTEXT, sent|defwinproc },
1457 { WM_ERASEBKGND, sent },
1458 { WM_CTLCOLORDLG, sent|defwinproc },
1459 { WM_WINDOWPOSCHANGED, sent|wparam, 0 },
1460 { WM_PAINT, sent },
1461 /* (bunch of WM_CTLCOLOR* for each control) */
1462 { WM_PAINT, sent|parent },
1463 { WM_ENTERIDLE, sent|parent|wparam, 0 },
1464 { WM_SETCURSOR, sent|parent },
1465 { 0 }
1466 };
1467 /* SetMenu for NonVisible windows with size change*/
1468 static const struct message WmSetMenuNonVisibleSizeChangeSeq[] = {
1469 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1470 { WM_NCCALCSIZE, sent|wparam, 1 },
1471 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1472 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW },
1473 { WM_MOVE, sent|defwinproc },
1474 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1475 { WM_NCCALCSIZE,sent|wparam|optional, 1 }, /* XP */
1476 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1477 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
1478 { WM_GETTEXT, sent|optional },
1479 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1480 { 0 }
1481 };
1482 /* SetMenu for NonVisible windows with no size change */
1483 static const struct message WmSetMenuNonVisibleNoSizeChangeSeq[] = {
1484 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1485 { WM_NCCALCSIZE, sent|wparam, 1 },
1486 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1487 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1488 { 0 }
1489 };
1490 /* SetMenu for Visible windows with size change */
1491 static const struct message WmSetMenuVisibleSizeChangeSeq[] = {
1492 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1493 { WM_NCCALCSIZE, sent|wparam, 1 },
1494 { 0x0093, sent|defwinproc|optional },
1495 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1496 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1497 { 0x0093, sent|defwinproc|optional },
1498 { 0x0093, sent|defwinproc|optional },
1499 { 0x0091, sent|defwinproc|optional },
1500 { 0x0092, sent|defwinproc|optional },
1501 { WM_GETTEXT, sent|defwinproc|optional },
1502 { WM_ERASEBKGND, sent|optional },
1503 { WM_ACTIVATE, sent|optional },
1504 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1505 { WM_MOVE, sent|defwinproc },
1506 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1507 { 0x0093, sent|optional },
1508 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1509 { 0x0093, sent|defwinproc|optional },
1510 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1511 { 0x0093, sent|defwinproc|optional },
1512 { 0x0093, sent|defwinproc|optional },
1513 { 0x0091, sent|defwinproc|optional },
1514 { 0x0092, sent|defwinproc|optional },
1515 { WM_ERASEBKGND, sent|optional },
1516 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1517 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
1518 { 0 }
1519 };
1520 /* SetMenu for Visible windows with no size change */
1521 static const struct message WmSetMenuVisibleNoSizeChangeSeq[] = {
1522 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1523 { WM_NCCALCSIZE, sent|wparam, 1 },
1524 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1525 { WM_GETTEXT, sent|defwinproc|optional },
1526 { WM_ERASEBKGND, sent|optional },
1527 { WM_ACTIVATE, sent|optional },
1528 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1529 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1530 { 0 }
1531 };
1532 /* DrawMenuBar for a visible window */
1533 static const struct message WmDrawMenuBarSeq[] =
1534 {
1535 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1536 { WM_NCCALCSIZE, sent|wparam, 1 },
1537 { 0x0093, sent|defwinproc|optional },
1538 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1539 { 0x0093, sent|defwinproc|optional },
1540 { 0x0093, sent|defwinproc|optional },
1541 { 0x0091, sent|defwinproc|optional },
1542 { 0x0092, sent|defwinproc|optional },
1543 { WM_GETTEXT, sent|defwinproc|optional },
1544 { WM_ERASEBKGND, sent|optional },
1545 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1546 { 0x0093, sent|optional },
1547 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1548 { 0 }
1549 };
1550
1551 static const struct message WmSetRedrawFalseSeq[] =
1552 {
1553 { WM_SETREDRAW, sent|wparam, 0 },
1554 { 0 }
1555 };
1556
1557 static const struct message WmSetRedrawTrueSeq[] =
1558 {
1559 { WM_SETREDRAW, sent|wparam, 1 },
1560 { 0 }
1561 };
1562
1563 static const struct message WmEnableWindowSeq_1[] =
1564 {
1565 { WM_CANCELMODE, sent|wparam|lparam, 0, 0 },
1566 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1567 { HCBT_SETFOCUS, hook|optional },
1568 { WM_KILLFOCUS, sent|optional },
1569 { WM_ENABLE, sent|wparam|lparam, FALSE, 0 },
1570 { 0 }
1571 };
1572
1573 static const struct message WmEnableWindowSeq_2[] =
1574 {
1575 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1576 { WM_ENABLE, sent|wparam|lparam, TRUE, 0 },
1577 { 0 }
1578 };
1579
1580 static const struct message WmGetScrollRangeSeq[] =
1581 {
1582 { SBM_GETRANGE, sent },
1583 { 0 }
1584 };
1585 static const struct message WmGetScrollInfoSeq[] =
1586 {
1587 { SBM_GETSCROLLINFO, sent },
1588 { 0 }
1589 };
1590 static const struct message WmSetScrollRangeSeq[] =
1591 {
1592 /* MSDN claims that Windows sends SBM_SETRANGE message, but win2k SP4
1593 sends SBM_SETSCROLLINFO.
1594 */
1595 { SBM_SETSCROLLINFO, sent },
1596 { 0 }
1597 };
1598 /* SetScrollRange for a window without a non-client area */
1599 static const struct message WmSetScrollRangeHSeq_empty[] =
1600 {
1601 { EVENT_OBJECT_VALUECHANGE, winevent_hook|wparam|lparam, OBJID_HSCROLL, 0 },
1602 { 0 }
1603 };
1604 static const struct message WmSetScrollRangeVSeq_empty[] =
1605 {
1606 { EVENT_OBJECT_VALUECHANGE, winevent_hook|wparam|lparam, OBJID_VSCROLL, 0 },
1607 { 0 }
1608 };
1609 static const struct message WmSetScrollRangeHVSeq[] =
1610 {
1611 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1612 { WM_NCCALCSIZE, sent|wparam, 1 },
1613 { WM_GETTEXT, sent|defwinproc|optional },
1614 { WM_ERASEBKGND, sent|optional },
1615 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1616 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1617 { EVENT_OBJECT_VALUECHANGE, winevent_hook|lparam|optional, 0/*OBJID_HSCROLL or OBJID_VSCROLL*/, 0 },
1618 { 0 }
1619 };
1620 /* SetScrollRange for a window with a non-client area */
1621 static const struct message WmSetScrollRangeHV_NC_Seq[] =
1622 {
1623 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1624 { WM_NCCALCSIZE, sent|wparam, 1 },
1625 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1626 { WM_NCPAINT, sent|optional },
1627 { WM_STYLECHANGING, sent|defwinproc|optional },
1628 { WM_STYLECHANGED, sent|defwinproc|optional },
1629 { WM_STYLECHANGING, sent|defwinproc|optional },
1630 { WM_STYLECHANGED, sent|defwinproc|optional },
1631 { WM_STYLECHANGING, sent|defwinproc|optional },
1632 { WM_STYLECHANGED, sent|defwinproc|optional },
1633 { WM_STYLECHANGING, sent|defwinproc|optional },
1634 { WM_STYLECHANGED, sent|defwinproc|optional },
1635 { WM_GETTEXT, sent|defwinproc|optional },
1636 { WM_GETTEXT, sent|defwinproc|optional },
1637 { WM_ERASEBKGND, sent|optional },
1638 { WM_CTLCOLORDLG, sent|defwinproc|optional }, /* sent to a parent of the dialog */
1639 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOCLIENTMOVE, 0, SWP_NOCLIENTSIZE },
1640 { WM_SIZE, sent|defwinproc|optional },
1641 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1642 { EVENT_OBJECT_VALUECHANGE, winevent_hook|lparam|optional, 0/*OBJID_HSCROLL or OBJID_VSCROLL*/, 0 },
1643 { WM_GETTEXT, sent|optional },
1644 { WM_GETTEXT, sent|optional },
1645 { WM_GETTEXT, sent|optional },
1646 { WM_GETTEXT, sent|optional },
1647 { 0 }
1648 };
1649 /* test if we receive the right sequence of messages */
1650 /* after calling ShowWindow( SW_SHOWNA) */
1651 static const struct message WmSHOWNAChildInvisParInvis[] = {
1652 { WM_SHOWWINDOW, sent|wparam, 1 },
1653 { 0 }
1654 };
1655 static const struct message WmSHOWNAChildVisParInvis[] = {
1656 { WM_SHOWWINDOW, sent|wparam, 1 },
1657 { 0 }
1658 };
1659 static const struct message WmSHOWNAChildVisParVis[] = {
1660 { WM_SHOWWINDOW, sent|wparam, 1 },
1661 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1662 { 0 }
1663 };
1664 static const struct message WmSHOWNAChildInvisParVis[] = {
1665 { WM_SHOWWINDOW, sent|wparam, 1 },
1666 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1667 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1668 { WM_ERASEBKGND, sent|optional },
1669 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOACTIVATE|SWP_NOCLIENTMOVE },
1670 { 0 }
1671 };
1672 static const struct message WmSHOWNATopVisible[] = {
1673 { WM_SHOWWINDOW, sent|wparam, 1 },
1674 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1675 { WM_NCPAINT, sent|wparam|optional, 1 },
1676 { WM_GETTEXT, sent|defwinproc|optional },
1677 { WM_ERASEBKGND, sent|optional },
1678 { WM_WINDOWPOSCHANGED, sent|optional },
1679 { 0 }
1680 };
1681 static const struct message WmSHOWNATopInvisible[] = {
1682 { WM_NOTIFYFORMAT, sent|optional },
1683 { WM_QUERYUISTATE, sent|optional },
1684 { WM_WINDOWPOSCHANGING, sent|optional },
1685 { WM_GETMINMAXINFO, sent|optional },
1686 { WM_NCCALCSIZE, sent|optional },
1687 { WM_WINDOWPOSCHANGED, sent|optional },
1688 { WM_SHOWWINDOW, sent|wparam, 1 },
1689 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1690 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1691 { WM_NCPAINT, sent|wparam|optional, 1 },
1692 { WM_GETTEXT, sent|defwinproc|optional },
1693 { WM_ERASEBKGND, sent|optional },
1694 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1695 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1696 { WM_NCPAINT, sent|wparam|optional, 1 },
1697 { WM_ERASEBKGND, sent|optional },
1698 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1699 { WM_SIZE, sent|wparam, SIZE_RESTORED },
1700 { WM_MOVE, sent },
1701 { 0 }
1702 };
1703
1704 static int after_end_dialog, test_def_id;
1705 static int sequence_cnt, sequence_size;
1706 static struct recvd_message* sequence;
1707 static int log_all_parent_messages;
1708 static int paint_loop_done;
1709
1710 /* user32 functions */
1711 static HWND (WINAPI *pGetAncestor)(HWND,UINT);
1712 static BOOL (WINAPI *pGetMenuInfo)(HMENU,LPCMENUINFO);
1713 static void (WINAPI *pNotifyWinEvent)(DWORD, HWND, LONG, LONG);
1714 static BOOL (WINAPI *pSetMenuInfo)(HMENU,LPCMENUINFO);
1715 static HWINEVENTHOOK (WINAPI *pSetWinEventHook)(DWORD, DWORD, HMODULE, WINEVENTPROC, DWORD, DWORD, DWORD);
1716 static BOOL (WINAPI *pTrackMouseEvent)(TRACKMOUSEEVENT*);
1717 static BOOL (WINAPI *pUnhookWinEvent)(HWINEVENTHOOK);
1718 /* kernel32 functions */
1719 static BOOL (WINAPI *pGetCPInfoExA)(UINT, DWORD, LPCPINFOEXA);
1720
1721 static void init_procs(void)
1722 {
1723 HMODULE user32 = GetModuleHandleA("user32.dll");
1724 HMODULE kernel32 = GetModuleHandleA("kernel32.dll");
1725
1726 #define GET_PROC(dll, func) \
1727 p ## func = (void*)GetProcAddress(dll, #func); \
1728 if(!p ## func) { \
1729 trace("GetProcAddress(%s) failed\n", #func); \
1730 }
1731
1732 GET_PROC(user32, GetAncestor)
1733 GET_PROC(user32, GetMenuInfo)
1734 GET_PROC(user32, NotifyWinEvent)
1735 GET_PROC(user32, SetMenuInfo)
1736 GET_PROC(user32, SetWinEventHook)
1737 GET_PROC(user32, TrackMouseEvent)
1738 GET_PROC(user32, UnhookWinEvent)
1739
1740 GET_PROC(kernel32, GetCPInfoExA)
1741
1742 #undef GET_PROC
1743 }
1744
1745 static const char *get_winpos_flags(UINT flags)
1746 {
1747 static char buffer[300];
1748
1749 buffer[0] = 0;
1750 #define DUMP(flag) do { if (flags & flag) { strcat( buffer, "|" #flag ); flags &= ~flag; } } while(0)
1751 DUMP( SWP_SHOWWINDOW );
1752 DUMP( SWP_HIDEWINDOW );
1753 DUMP( SWP_NOACTIVATE );
1754 DUMP( SWP_FRAMECHANGED );
1755 DUMP( SWP_NOCOPYBITS );
1756 DUMP( SWP_NOOWNERZORDER );
1757 DUMP( SWP_NOSENDCHANGING );
1758 DUMP( SWP_DEFERERASE );
1759 DUMP( SWP_ASYNCWINDOWPOS );
1760 DUMP( SWP_NOZORDER );
1761 DUMP( SWP_NOREDRAW );
1762 DUMP( SWP_NOSIZE );
1763 DUMP( SWP_NOMOVE );
1764 DUMP( SWP_NOCLIENTSIZE );
1765 DUMP( SWP_NOCLIENTMOVE );
1766 if (flags) sprintf(buffer + strlen(buffer),"|0x%04x", flags);
1767 return buffer + 1;
1768 #undef DUMP
1769 }
1770
1771 static BOOL ignore_message( UINT message )
1772 {
1773 /* these are always ignored */
1774 return (message >= 0xc000 ||
1775 message == WM_GETICON ||
1776 message == WM_GETOBJECT ||
1777 message == WM_TIMECHANGE ||
1778 message == WM_DISPLAYCHANGE ||
1779 message == WM_DEVICECHANGE);
1780 }
1781
1782
1783 #define add_message(msg) add_message_(__LINE__,msg);
1784 static void add_message_(int line, const struct recvd_message *msg)
1785 {
1786 struct recvd_message *seq;
1787
1788 if (!sequence)
1789 {
1790 sequence_size = 10;
1791 sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof(*sequence) );
1792 }
1793 if (sequence_cnt == sequence_size)
1794 {
1795 sequence_size *= 2;
1796 sequence = HeapReAlloc( GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence) );
1797 }
1798 assert(sequence);
1799
1800 seq = &sequence[sequence_cnt];
1801 seq->hwnd = msg->hwnd;
1802 seq->message = msg->message;
1803 seq->flags = msg->flags;
1804 seq->wParam = msg->wParam;
1805 seq->lParam = msg->lParam;
1806 seq->line = line;
1807 seq->descr = msg->descr;
1808 seq->output[0] = 0;
1809
1810 if (msg->descr)
1811 {
1812 if (msg->flags & hook)
1813 {
1814 static const char * const CBT_code_name[10] =
1815 {
1816 "HCBT_MOVESIZE",
1817 "HCBT_MINMAX",
1818 "HCBT_QS",
1819 "HCBT_CREATEWND",
1820 "HCBT_DESTROYWND",
1821 "HCBT_ACTIVATE",
1822 "HCBT_CLICKSKIPPED",
1823 "HCBT_KEYSKIPPED",
1824 "HCBT_SYSCOMMAND",
1825 "HCBT_SETFOCUS"
1826 };
1827 const char *code_name = (msg->message <= HCBT_SETFOCUS) ? CBT_code_name[msg->message] : "Unknown";
1828
1829 sprintf( seq->output, "%s: hook %d (%s) wp %08lx lp %08lx",
1830 msg->descr, msg->message, code_name, msg->wParam, msg->lParam );
1831 }
1832 else if (msg->flags & winevent_hook)
1833 {
1834 sprintf( seq->output, "%s: winevent %p %08x %08lx %08lx",
1835 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
1836 }
1837 else
1838 {
1839 switch (msg->message)
1840 {
1841 case WM_WINDOWPOSCHANGING:
1842 case WM_WINDOWPOSCHANGED:
1843 {
1844 WINDOWPOS *winpos = (WINDOWPOS *)msg->lParam;
1845
1846 sprintf( seq->output, "%s: %p WM_WINDOWPOS%s wp %08lx lp %08lx after %p x %d y %d cx %d cy %d flags %s",
1847 msg->descr, msg->hwnd,
1848 (msg->message == WM_WINDOWPOSCHANGING) ? "CHANGING" : "CHANGED",
1849 msg->wParam, msg->lParam, winpos->hwndInsertAfter,
1850 winpos->x, winpos->y, winpos->cx, winpos->cy,
1851 get_winpos_flags(winpos->flags) );
1852
1853 /* Log only documented flags, win2k uses 0x1000 and 0x2000
1854 * in the high word for internal purposes
1855 */
1856 seq->wParam = winpos->flags & 0xffff;
1857 /* We are not interested in the flags that don't match under XP and Win9x */
1858 seq->wParam &= ~SWP_NOZORDER;
1859 break;
1860 }
1861
1862 case WM_DRAWITEM:
1863 {
1864 DRAW_ITEM_STRUCT di;
1865 DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)msg->lParam;
1866
1867 sprintf( seq->output, "%s: %p WM_DRAWITEM: type %x, ctl_id %x, item_id %x, action %x, state %x",
1868 msg->descr, msg->hwnd, dis->CtlType, dis->CtlID,
1869 dis->itemID, dis->itemAction, dis->itemState);
1870
1871 di.u.lp = 0;
1872 di.u.item.type = dis->CtlType;
1873 di.u.item.ctl_id = dis->CtlID;
1874 if (dis->CtlType == ODT_LISTBOX ||
1875 dis->CtlType == ODT_COMBOBOX ||
1876 dis->CtlType == ODT_MENU)
1877 di.u.item.item_id = dis->itemID;
1878 di.u.item.action = dis->itemAction;
1879 di.u.item.state = dis->itemState;
1880
1881 seq->lParam = di.u.lp;
1882 break;
1883 }
1884 default:
1885 if (msg->message >= 0xc000) return; /* ignore registered messages */
1886 sprintf( seq->output, "%s: %p %04x wp %08lx lp %08lx",
1887 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
1888 }
1889 if (msg->flags & (sent|posted|parent|defwinproc|beginpaint))
1890 sprintf( seq->output + strlen(seq->output), " (flags %x)", msg->flags );
1891 }
1892 }
1893
1894 sequence_cnt++;
1895 }
1896
1897 /* try to make sure pending X events have been processed before continuing */
1898 static void flush_events(void)
1899 {
1900 MSG msg;
1901 int diff = 200;
1902 int min_timeout = 100;
1903 DWORD time = GetTickCount() + diff;
1904
1905 while (diff > 0)
1906 {
1907 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
1908 while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
1909 diff = time - GetTickCount();
1910 }
1911 }
1912
1913 static void flush_sequence(void)
1914 {
1915 HeapFree(GetProcessHeap(), 0, sequence);
1916 sequence = 0;
1917 sequence_cnt = sequence_size = 0;
1918 }
1919
1920 static void dump_sequence(const struct message *expected, const char *context, const char *file, int line)
1921 {
1922 const struct recvd_message *actual = sequence;
1923 unsigned int count = 0;
1924
1925 trace_(file, line)("Failed sequence %s:\n", context );
1926 while (expected->message && actual->message)
1927 {
1928 if (actual->output[0])
1929 {
1930 if (expected->flags & hook)
1931 {
1932 trace_(file, line)( " %u: expected: hook %04x - actual: %s\n",
1933 count, expected->message, actual->output );
1934 }
1935 else if (expected->flags & winevent_hook)
1936 {
1937 trace_(file, line)( " %u: expected: winevent %04x - actual: %s\n",
1938 count, expected->message, actual->output );
1939 }
1940 else
1941 {
1942 trace_(file, line)( " %u: expected: msg %04x - actual: %s\n",
1943 count, expected->message, actual->output );
1944 }
1945 }
1946
1947 if (expected->message == actual->message)
1948 {
1949 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) &&
1950 (expected->flags & optional))
1951 {
1952 /* don't match messages if their defwinproc status differs */
1953 expected++;
1954 }
1955 else
1956 {
1957 expected++;
1958 actual++;
1959 }
1960 }
1961 /* silently drop winevent messages if there is no support for them */
1962 else if ((expected->flags & optional) || ((expected->flags & winevent_hook) && !hEvent_hook))
1963 expected++;
1964 else
1965 {
1966 expected++;
1967 actual++;
1968 }
1969 count++;
1970 }
1971
1972 /* optional trailing messages */
1973 while (expected->message && ((expected->flags & optional) ||
1974 ((expected->flags & winevent_hook) && !hEvent_hook)))
1975 {
1976 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
1977 expected++;
1978 count++;
1979 }
1980
1981 if (expected->message)
1982 {
1983 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
1984 return;
1985 }
1986
1987 while (actual->message && actual->output[0])
1988 {
1989 trace_(file, line)( " %u: expected: nothing - actual: %s\n", count, actual->output );
1990 actual++;
1991 count++;
1992 }
1993 }
1994
1995 #define ok_sequence( exp, contx, todo) \
1996 ok_sequence_( (exp), (contx), (todo), __FILE__, __LINE__)
1997
1998
1999 static void ok_sequence_(const struct message *expected_list, const char *context, int todo,
2000 const char *file, int line)
2001 {
2002 static const struct recvd_message end_of_sequence;
2003 const struct message *expected = expected_list;
2004 const struct recvd_message *actual;
2005 int failcount = 0, dump = 0;
2006 unsigned int count = 0;
2007
2008 add_message(&end_of_sequence);
2009
2010 actual = sequence;
2011
2012 while (expected->message && actual->message)
2013 {
2014 if (expected->message == actual->message)
2015 {
2016 if (expected->flags & wparam)
2017 {
2018 if (((expected->wParam ^ actual->wParam) & ~expected->wp_mask) && todo)
2019 {
2020 todo_wine {
2021 failcount ++;
2022 if (strcmp(winetest_platform, "wine")) dump++;
2023 ok_( file, line) (FALSE,
2024 "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
2025 context, count, expected->message, expected->wParam, actual->wParam);
2026 }
2027 }
2028 else
2029 {
2030 ok_( file, line)( ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) == 0,
2031 "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
2032 context, count, expected->message, expected->wParam, actual->wParam);
2033 if ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) dump++;
2034 }
2035
2036 }
2037 if (expected->flags & lparam)
2038 {
2039 if (((expected->lParam ^ actual->lParam) & ~expected->lp_mask) && todo)
2040 {
2041 todo_wine {
2042 failcount ++;
2043 if (strcmp(winetest_platform, "wine")) dump++;
2044 ok_( file, line) (FALSE,
2045 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
2046 context, count, expected->message, expected->lParam, actual->lParam);
2047 }
2048 }
2049 else
2050 {
2051 ok_( file, line)(((expected->lParam ^ actual->lParam) & ~expected->lp_mask) == 0,
2052 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
2053 context, count, expected->message, expected->lParam, actual->lParam);
2054 if ((expected->lParam ^ actual->lParam) & ~expected->lp_mask) dump++;
2055 }
2056 }
2057 if ((expected->flags & optional) &&
2058 ((expected->flags ^ actual->flags) & (defwinproc|parent)))
2059 {
2060 /* don't match optional messages if their defwinproc or parent status differs */
2061 expected++;
2062 count++;
2063 continue;
2064 }
2065 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
2066 {
2067 todo_wine {
2068 failcount ++;
2069 if (strcmp(winetest_platform, "wine")) dump++;
2070 ok_( file, line) (FALSE,
2071 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
2072 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
2073 }
2074 }
2075 else
2076 {
2077 ok_( file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
2078 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
2079 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
2080 if ((expected->flags & defwinproc) != (actual->flags & defwinproc)) dump++;
2081 }
2082
2083 ok_( file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
2084 "%s: %u: the msg 0x%04x should %shave been sent by BeginPaint\n",
2085 context, count, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
2086 if ((expected->flags & beginpaint) != (actual->flags & beginpaint)) dump++;
2087
2088 ok_( file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
2089 "%s: %u: the msg 0x%04x should have been %s\n",
2090 context, count, expected->message, (expected->flags & posted) ? "posted" : "sent");
2091 if ((expected->flags & (sent|posted)) != (actual->flags & (sent|posted))) dump++;
2092
2093 ok_( file, line) ((expected->flags & parent) == (actual->flags & parent),
2094 "%s: %u: the msg 0x%04x was expected in %s\n",
2095 context, count, expected->message, (expected->flags & parent) ? "parent" : "child");
2096 if ((expected->flags & parent) != (actual->flags & parent)) dump++;
2097
2098 ok_( file, line) ((expected->flags & hook) == (actual->flags & hook),
2099 "%s: %u: the msg 0x%04x should have been sent by a hook\n",
2100 context, count, expected->message);
2101 if ((expected->flags & hook) != (actual->flags & hook)) dump++;
2102
2103 ok_( file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
2104 "%s: %u: the msg 0x%04x should have been sent by a winevent hook\n",
2105 context, count, expected->message);
2106 if ((expected->flags & winevent_hook) != (actual->flags & winevent_hook)) dump++;
2107
2108 expected++;
2109 actual++;
2110 }
2111 /* silently drop hook messages if there is no support for them */
2112 else if ((expected->flags & optional) ||
2113 ((expected->flags & hook) && !hCBT_hook) ||
2114 ((expected->flags & winevent_hook) && !hEvent_hook))
2115 expected++;
2116 else if (todo)
2117 {
2118 failcount++;
2119 todo_wine {
2120 if (strcmp(winetest_platform, "wine")) dump++;
2121 ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
2122 context, count, expected->message, actual->message);
2123 }
2124 goto done;
2125 }
2126 else
2127 {
2128 ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
2129 context, count, expected->message, actual->message);
2130 dump++;
2131 expected++;
2132 actual++;
2133 }
2134 count++;
2135 }
2136
2137 /* skip all optional trailing messages */
2138 while (expected->message && ((expected->flags & optional) ||
2139 ((expected->flags & hook) && !hCBT_hook) ||
2140 ((expected->flags & winevent_hook) && !hEvent_hook)))
2141 expected++;
2142
2143 if (todo)
2144 {
2145 todo_wine {
2146 if (expected->message || actual->message) {
2147 failcount++;
2148 if (strcmp(winetest_platform, "wine")) dump++;
2149 ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
2150 context, count, expected->message, actual->message);
2151 }
2152 }
2153 }
2154 else
2155 {
2156 if (expected->message || actual->message)
2157 {
2158 dump++;
2159 ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
2160 context, count, expected->message, actual->message);
2161 }
2162 }
2163 if( todo && !failcount) /* succeeded yet marked todo */
2164 todo_wine {
2165 if (!strcmp(winetest_platform, "wine")) dump++;
2166 ok_( file, line)( TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
2167 }
2168
2169 done:
2170 if (dump) dump_sequence(expected_list, context, file, line);
2171 flush_sequence();
2172 }
2173
2174 #define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
2175
2176 /******************************** MDI test **********************************/
2177
2178 /* CreateWindow for MDI frame window, initially visible */
2179 static const struct message WmCreateMDIframeSeq[] = {
2180 { HCBT_CREATEWND, hook },
2181 { WM_GETMINMAXINFO, sent },
2182 { WM_NCCREATE, sent },
2183 { WM_NCCALCSIZE, sent|wparam, 0 },
2184 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
2185 { WM_CREATE, sent },
2186 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2187 { WM_NOTIFYFORMAT, sent|optional },
2188 { WM_QUERYUISTATE, sent|optional },
2189 { WM_WINDOWPOSCHANGING, sent|optional },
2190 { WM_GETMINMAXINFO, sent|optional },
2191 { WM_NCCALCSIZE, sent|optional },
2192 { WM_WINDOWPOSCHANGED, sent|optional },
2193 { WM_SHOWWINDOW, sent|wparam, 1 },
2194 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2195 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2196 { HCBT_ACTIVATE, hook },
2197 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
2198 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
2199 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* XP */
2200 { WM_ACTIVATEAPP, sent|wparam|optional, 1 }, /* Win9x doesn't send it */
2201 { WM_NCACTIVATE, sent },
2202 { WM_GETTEXT, sent|defwinproc|optional },
2203 { WM_ACTIVATE, sent|wparam, 1 },
2204 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* Win9x */
2205 { HCBT_SETFOCUS, hook },
2206 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2207 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
2208 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2209 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
2210 /* Win9x adds SWP_NOZORDER below */
2211 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2212 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP */
2213 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
2214 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2215 { WM_MOVE, sent },
2216 { 0 }
2217 };
2218 /* DestroyWindow for MDI frame window, initially visible */
2219 static const struct message WmDestroyMDIframeSeq[] = {
2220 { HCBT_DESTROYWND, hook },
2221 { 0x0090, sent|optional },
2222 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2223 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2224 { WM_NCACTIVATE, sent|wparam|optional, 0 }, /* Win9x */
2225 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2226 { WM_NCACTIVATE, sent|wparam|optional, 0 }, /* XP */
2227 { WM_ACTIVATE, sent|wparam|optional, 0 }, /* Win9x */
2228 { WM_ACTIVATEAPP, sent|wparam|optional, 0 }, /* Win9x */
2229 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, OBJID_CARET, 0 },
2230 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2231 { WM_DESTROY, sent },
2232 { WM_NCDESTROY, sent },
2233 { 0 }
2234 };
2235 /* CreateWindow for MDI client window, initially visible */
2236 static const struct message WmCreateMDIclientSeq[] = {
2237 { HCBT_CREATEWND, hook },
2238 { WM_NCCREATE, sent },
2239 { WM_NCCALCSIZE, sent|wparam, 0 },
2240 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2241 { WM_CREATE, sent },
2242 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2243 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2244 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2245 { WM_MOVE, sent },
2246 { WM_PARENTNOTIFY, sent|wparam, WM_CREATE }, /* in MDI frame */
2247 { WM_SHOWWINDOW, sent|wparam, 1 },
2248 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2249 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2250 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2251 { 0 }
2252 };
2253 /* ShowWindow(SW_SHOW) for MDI client window */
2254 static const struct message WmShowMDIclientSeq[] = {
2255 { WM_SHOWWINDOW, sent|wparam, 1 },
2256 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2257 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2258 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2259 { 0 }
2260 };
2261 /* ShowWindow(SW_HIDE) for MDI client window */
2262 static const struct message WmHideMDIclientSeq[] = {
2263 { WM_SHOWWINDOW, sent|wparam, 0 },
2264 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2265 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam|optional, 0, 0 }, /* win2000 */
2266 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP */
2267 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2268 { 0 }
2269 };
2270 /* DestroyWindow for MDI client window, initially visible */
2271 static const struct message WmDestroyMDIclientSeq[] = {
2272 { HCBT_DESTROYWND, hook },
2273 { 0x0090, sent|optional },
2274 { WM_PARENTNOTIFY, sent|wparam, WM_DESTROY }, /* in MDI frame */
2275 { WM_SHOWWINDOW, sent|wparam, 0 },
2276 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2277 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2278 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2279 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2280 { WM_DESTROY, sent },
2281 { WM_NCDESTROY, sent },
2282 { 0 }
2283 };
2284 /* CreateWindow for MDI child window, initially visible */
2285 static const struct message WmCreateMDIchildVisibleSeq[] = {
2286 { HCBT_CREATEWND, hook },
2287 { WM_NCCREATE, sent },
2288 { WM_NCCALCSIZE, sent|wparam, 0 },
2289 { WM_CREATE, sent },
2290 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2291 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2292 { WM_MOVE, sent },
2293 /* Win2k sends wparam set to
2294 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2295 * while Win9x doesn't bother to set child window id according to
2296 * CLIENTCREATESTRUCT.idFirstChild
2297 */
2298 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2299 { WM_SHOWWINDOW, sent|wparam, 1 },
2300 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2301 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2302 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2303 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2304 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2305 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2306 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2307
2308 /* Win9x: message sequence terminates here. */
2309
2310 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2311 { HCBT_SETFOCUS, hook }, /* in MDI client */
2312 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2313 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2314 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2315 { WM_SETFOCUS, sent }, /* in MDI client */
2316 { HCBT_SETFOCUS, hook },
2317 { WM_KILLFOCUS, sent }, /* in MDI client */
2318 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2319 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2320 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2321 { WM_SETFOCUS, sent|defwinproc },
2322 { WM_MDIACTIVATE, sent|defwinproc },
2323 { 0 }
2324 };
2325 /* CreateWindow for MDI child window with invisible parent */
2326 static const struct message WmCreateMDIchildInvisibleParentSeq[] = {
2327 { HCBT_CREATEWND, hook },
2328 { WM_GETMINMAXINFO, sent },
2329 { WM_NCCREATE, sent },
2330 { WM_NCCALCSIZE, sent|wparam, 0 },
2331 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2332 { WM_CREATE, sent },
2333 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2334 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2335 { WM_MOVE, sent },
2336 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2337 { WM_SHOWWINDOW, sent|wparam, 1 },
2338 { WM_MDIREFRESHMENU, sent }, /* in MDI client */
2339 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2340 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2341 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2342
2343 /* Win9x: message sequence terminates here. */
2344
2345 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2346 { HCBT_SETFOCUS, hook }, /* in MDI client */
2347 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2348 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2349 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2350 { WM_SETFOCUS, sent }, /* in MDI client */
2351 { HCBT_SETFOCUS, hook },
2352 { WM_KILLFOCUS, sent }, /* in MDI client */
2353 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2354 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2355 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2356 { WM_SETFOCUS, sent|defwinproc },
2357 { WM_MDIACTIVATE, sent|defwinproc },
2358 { 0 }
2359 };
2360 /* DestroyWindow for MDI child window, initially visible */
2361 static const struct message WmDestroyMDIchildVisibleSeq[] = {
2362 { HCBT_DESTROYWND, hook },
2363 /* Win2k sends wparam set to
2364 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2365 * while Win9x doesn't bother to set child window id according to
2366 * CLIENTCREATESTRUCT.idFirstChild
2367 */
2368 { 0x0090, sent|optional },
2369 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2370 { WM_SHOWWINDOW, sent|wparam, 0 },
2371 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2372 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2373 { WM_ERASEBKGND, sent|parent|optional },
2374 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2375
2376 /* { WM_DESTROY, sent }
2377 * Win9x: message sequence terminates here.
2378 */
2379
2380 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2381 { WM_KILLFOCUS, sent },
2382 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2383 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2384 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2385 { WM_SETFOCUS, sent }, /* in MDI client */
2386
2387 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2388 { WM_KILLFOCUS, sent }, /* in MDI client */
2389 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2390 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2391 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2392 { WM_SETFOCUS, sent }, /* in MDI client */
2393
2394 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2395
2396 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2397 { WM_KILLFOCUS, sent },
2398 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2399 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2400 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2401 { WM_SETFOCUS, sent }, /* in MDI client */
2402
2403 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2404 { WM_KILLFOCUS, sent }, /* in MDI client */
2405 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2406 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2407 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2408 { WM_SETFOCUS, sent }, /* in MDI client */
2409
2410 { WM_DESTROY, sent },
2411
2412 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2413 { WM_KILLFOCUS, sent },
2414 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2415 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2416 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2417 { WM_SETFOCUS, sent }, /* in MDI client */
2418
2419 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2420 { WM_KILLFOCUS, sent }, /* in MDI client */
2421 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2422 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2423 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2424 { WM_SETFOCUS, sent }, /* in MDI client */
2425
2426 { WM_NCDESTROY, sent },
2427 { 0 }
2428 };
2429 /* CreateWindow for MDI child window, initially invisible */
2430 static const struct message WmCreateMDIchildInvisibleSeq[] = {
2431 { HCBT_CREATEWND, hook },
2432 { WM_NCCREATE, sent },
2433 { WM_NCCALCSIZE, sent|wparam, 0 },
2434 { WM_CREATE, sent },
2435 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2436 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2437 { WM_MOVE, sent },
2438 /* Win2k sends wparam set to
2439 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2440 * while Win9x doesn't bother to set child window id according to
2441 * CLIENTCREATESTRUCT.idFirstChild
2442 */
2443 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2444 { 0 }
2445 };
2446 /* DestroyWindow for MDI child window, initially invisible */
2447 static const struct message WmDestroyMDIchildInvisibleSeq[] = {
2448 { HCBT_DESTROYWND, hook },
2449 /* Win2k sends wparam set to
2450 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2451 * while Win9x doesn't bother to set child window id according to
2452 * CLIENTCREATESTRUCT.idFirstChild
2453 */
2454 { 0x0090, sent|optional },
2455 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2456 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2457 { WM_DESTROY, sent },
2458 { WM_NCDESTROY, sent },
2459 /* FIXME: Wine destroys an icon/title window while Windows doesn't */
2460 { WM_PARENTNOTIFY, sent|wparam|optional, WM_DESTROY }, /* MDI client */
2461 { 0 }
2462 };
2463 /* CreateWindow for the 1st MDI child window, initially visible and maximized */
2464 static const struct message WmCreateMDIchildVisibleMaxSeq1[] = {
2465 { HCBT_CREATEWND, hook },
2466 { WM_NCCREATE, sent },
2467 { WM_NCCALCSIZE, sent|wparam, 0 },
2468 { WM_CREATE, sent },
2469 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2470 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2471 { WM_MOVE, sent },
2472 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2473 { WM_GETMINMAXINFO, sent },
2474 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2475 { WM_NCCALCSIZE, sent|wparam, 1 },
2476 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2477 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2478 /* in MDI frame */
2479 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2480 { WM_NCCALCSIZE, sent|wparam, 1 },
2481 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2482 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2483 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2484 /* Win2k sends wparam set to
2485 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2486 * while Win9x doesn't bother to set child window id according to
2487 * CLIENTCREATESTRUCT.idFirstChild
2488 */
2489 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2490 { WM_SHOWWINDOW, sent|wparam, 1 },
2491 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2492 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2493 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2494 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2495 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2496 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2497 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc|optional, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE, 0, SWP_FRAMECHANGED },
2498
2499 /* Win9x: message sequence terminates here. */
2500
2501 { WM_NCACTIVATE, sent|wparam|defwinproc|optional, 1 },
2502 { HCBT_SETFOCUS, hook|optional }, /* in MDI client */
2503 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2504 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2505 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2506 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2507 { HCBT_SETFOCUS, hook|optional },
2508 { WM_KILLFOCUS, sent|optional }, /* in MDI client */
2509 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2510 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2511 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2512 { WM_SETFOCUS, sent|defwinproc|optional },
2513 { WM_MDIACTIVATE, sent|defwinproc|optional },
2514 /* in MDI frame */
2515 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2516 { WM_NCCALCSIZE, sent|wparam, 1 },
2517 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2518 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2519 { 0 }
2520 };
2521 /* CreateWindow for the 2nd MDI child window, initially visible and maximized */
2522 static const struct message WmCreateMDIchildVisibleMaxSeq2[] = {
2523 /* restore the 1st MDI child */
2524 { WM_SETREDRAW, sent|wparam, 0 },
2525 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWNORMAL },
2526 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
2527 { WM_NCCALCSIZE, sent|wparam, 1 },
2528 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2529 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2530 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2531 /* in MDI frame */
2532 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2533 { WM_NCCALCSIZE, sent|wparam, 1 },
2534 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2535 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2536 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2537 { WM_SETREDRAW, sent|wparam, 1 }, /* in the 1st MDI child */
2538 /* create the 2nd MDI child */
2539 { HCBT_CREATEWND, hook },
2540 { WM_NCCREATE, sent },
2541 { WM_NCCALCSIZE, sent|wparam, 0 },
2542 { WM_CREATE, sent },
2543 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2544 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2545 { WM_MOVE, sent },
2546 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2547 { WM_GETMINMAXINFO, sent },
2548 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2549 { WM_NCCALCSIZE, sent|wparam, 1 },
2550 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2551 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2552 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2553 /* in MDI frame */
2554 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2555 { WM_NCCALCSIZE, sent|wparam, 1 },
2556 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2557 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2558 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2559 /* Win2k sends wparam set to
2560 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2561 * while Win9x doesn't bother to set child window id according to
2562 * CLIENTCREATESTRUCT.idFirstChild
2563 */
2564 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2565 { WM_SHOWWINDOW, sent|wparam, 1 },
2566 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2567 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2568 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2569 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2570 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2571 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2572
2573 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
2574 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
2575
2576 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2577
2578 /* Win9x: message sequence terminates here. */
2579
2580 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2581 { HCBT_SETFOCUS, hook },
2582 { WM_KILLFOCUS, sent|defwinproc|optional }, /* in the 1st MDI child */
2583 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 }, /* in the 1st MDI child */
2584 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2585 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2586 { WM_SETFOCUS, sent }, /* in MDI client */
2587 { HCBT_SETFOCUS, hook },
2588 { WM_KILLFOCUS, sent }, /* in MDI client */
2589 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2590 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2591 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2592 { WM_SETFOCUS, sent|defwinproc },
2593
2594 { WM_MDIACTIVATE, sent|defwinproc },
2595 /* in MDI frame */
2596 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2597 { WM_NCCALCSIZE, sent|wparam, 1 },
2598 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2599 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2600 { 0 }
2601 };
2602 /* WM_MDICREATE MDI child window, initially visible and maximized */
2603 static const struct message WmCreateMDIchildVisibleMaxSeq3[] = {
2604 { WM_MDICREATE, sent },
2605 { HCBT_CREATEWND, hook },
2606 { WM_NCCREATE, sent },
2607 { WM_NCCALCSIZE, sent|wparam, 0 },
2608 { WM_CREATE, sent },
2609 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2610 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2611 { WM_MOVE, sent },
2612 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2613 { WM_GETMINMAXINFO, sent },
2614 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2615 { WM_NCCALCSIZE, sent|wparam, 1 },
2616 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2617 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2618
2619 /* in MDI frame */
2620 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2621 { WM_NCCALCSIZE, sent|wparam, 1 },
2622 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2623 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2624 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2625
2626 /* Win2k sends wparam set to
2627 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2628 * while Win9x doesn't bother to set child window id according to
2629 * CLIENTCREATESTRUCT.idFirstChild
2630 */
2631 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2632 { WM_SHOWWINDOW, sent|wparam, 1 },
2633 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2634
2635 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2636
2637 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2638 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2639 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2640
2641 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2642 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2643
2644 /* Win9x: message sequence terminates here. */
2645
2646 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2647 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2648 { HCBT_SETFOCUS, hook }, /* in MDI client */
2649 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2650 { WM_IME_NOTIFY, sent|wparam|optional, 2 },
2651 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
2652 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2653 { HCBT_SETFOCUS, hook|optional },
2654 { WM_KILLFOCUS, sent }, /* in MDI client */
2655 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2656 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2657 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2658 { WM_SETFOCUS, sent|defwinproc },
2659
2660 { WM_MDIACTIVATE, sent|defwinproc },
2661
2662 /* in MDI child */
2663 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2664 { WM_NCCALCSIZE, sent|wparam, 1 },
2665 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2666 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
2667
2668 /* in MDI frame */
2669 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2670 { WM_NCCALCSIZE, sent|wparam, 1 },
2671 { 0x0093, sent|defwinproc|optional },
2672 { 0x0093, sent|defwinproc|optional },
2673 { 0x0093, sent|defwinproc|optional },
2674 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2675 { WM_MOVE, sent|defwinproc },
2676 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2677
2678 /* in MDI client */
2679 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2680 { WM_NCCALCSIZE, sent|wparam, 1 },
2681 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2682 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2683
2684 /* in MDI child */
2685 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2686 { WM_NCCALCSIZE, sent|wparam, 1 },
2687 { 0x0093, sent|optional },
2688 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2689 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2690
2691 { 0x0093, sent|optional },
2692 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2693 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2694 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP sends it to MDI frame */
2695 { 0x0093, sent|defwinproc|optional },
2696 { 0x0093, sent|defwinproc|optional },
2697 { 0x0093, sent|defwinproc|optional },
2698 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2699 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
2700
2701 { 0 }
2702 };
2703 /* CreateWindow for the 1st MDI child window, initially invisible and maximized */
2704 static const struct message WmCreateMDIchildInvisibleMaxSeq4[] = {
2705 { HCBT_CREATEWND, hook },
2706 { WM_GETMINMAXINFO, sent },
2707 { WM_NCCREATE, sent },
2708 { WM_NCCALCSIZE, sent|wparam, 0 },
2709 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
2710 { WM_CREATE, sent },
2711 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2712 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2713 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE, 0, SWP_NOZORDER }, /* MDI frame */
2714 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* MDI frame */
2715 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE, 0, SWP_NOZORDER }, /* MDI frame */
2716 { WM_MOVE, sent },
2717 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2718 { WM_GETMINMAXINFO, sent },
2719 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2720 { WM_GETMINMAXINFO, sent|defwinproc },
2721 { WM_NCCALCSIZE, sent|wparam, 1 },
2722 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_STATECHANGED },
2723 { WM_MOVE, sent|defwinproc },
2724 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2725 /* in MDI frame */
2726 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2727 { WM_NCCALCSIZE, sent|wparam, 1 },
2728 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2729 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2730 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* MDI child */
2731 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2732 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2733 /* Win2k sends wparam set to
2734 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2735 * while Win9x doesn't bother to set child window id according to
2736 * CLIENTCREATESTRUCT.idFirstChild
2737 */
2738 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2739 { 0 }
2740 };
2741 /* WM_SYSCOMMAND/SC_CLOSE for the 2nd MDI child window, initially visible and maximized */
2742 static const struct message WmDestroyMDIchildVisibleMaxSeq2[] = {
2743 { WM_SYSCOMMAND, sent|wparam, SC_CLOSE },
2744 { HCBT_SYSCOMMAND, hook },
2745 { WM_CLOSE, sent|defwinproc },
2746 { WM_MDIDESTROY, sent }, /* in MDI client */
2747
2748 /* bring the 1st MDI child to top */
2749 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOSIZE|SWP_NOMOVE }, /* in the 1st MDI child */
2750 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, /* in the 2nd MDI child */
2751
2752 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2753
2754 { WM_CHILDACTIVATE, sent|defwinproc|wparam|lparam, 0, 0 }, /* in the 1st MDI child */
2755 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
2756 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
2757
2758 /* maximize the 1st MDI child */
2759 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2760 { WM_GETMINMAXINFO, sent|defwinproc },
2761 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_STATECHANGED },
2762 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
2763 { WM_CHILDACTIVATE, sent|defwinproc|wparam|lparam, 0, 0 },
2764 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2765 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2766
2767 /* restore the 2nd MDI child */
2768 { WM_SETREDRAW, sent|defwinproc|wparam, 0 },
2769 { HCBT_MINMAX, hook|lparam, 0, SW_NORMALNA },
2770 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_STATECHANGED },
2771 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
2772
2773 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2774
2775 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2776 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2777
2778 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2779
2780 { WM_SETREDRAW, sent|defwinproc|wparam, 1 },
2781 /* in MDI frame */
2782 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2783 { WM_NCCALCSIZE, sent|wparam, 1 },
2784 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2785 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2786 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2787
2788 /* bring the 1st MDI child to top */
2789 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2790 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2791 { HCBT_SETFOCUS, hook },
2792 { WM_KILLFOCUS, sent|defwinproc },
2793 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 },
2794 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2795 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2796 { WM_SETFOCUS, sent }, /* in MDI client */
2797 { HCBT_SETFOCUS, hook },
2798 { WM_KILLFOCUS, sent }, /* in MDI client */
2799 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2800 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2801 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2802 { WM_SETFOCUS, sent|defwinproc },
2803 { WM_MDIACTIVATE, sent|defwinproc },
2804 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2805
2806 /* apparently ShowWindow(SW_SHOW) on an MDI client */
2807 { WM_SHOWWINDOW, sent|wparam, 1 },
2808 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2809 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2810 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2811 { WM_MDIREFRESHMENU, sent },
2812
2813 { HCBT_DESTROYWND, hook },
2814 /* Win2k sends wparam set to
2815 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2816 * while Win9x doesn't bother to set child window id according to
2817 * CLIENTCREATESTRUCT.idFirstChild
2818 */
2819 { 0x0090, sent|defwinproc|optional },
2820 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2821 { WM_SHOWWINDOW, sent|defwinproc|wparam, 0 },
2822 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2823 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2824 { WM_ERASEBKGND, sent|parent|optional },
2825 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2826
2827 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2828 { WM_DESTROY, sent|defwinproc },
2829 { WM_NCDESTROY, sent|defwinproc },
2830 { 0 }
2831 };
2832 /* WM_MDIDESTROY for the single MDI child window, initially visible and maximized */
2833 static const struct message WmDestroyMDIchildVisibleMaxSeq1[] = {
2834 { WM_MDIDESTROY, sent }, /* in MDI client */
2835 { WM_SHOWWINDOW, sent|wparam, 0 },
2836 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2837 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2838 { WM_ERASEBKGND, sent|parent|optional },
2839 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2840
2841 { HCBT_SETFOCUS, hook },
2842 { WM_KILLFOCUS, sent },
2843 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2844 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2845 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2846 { WM_SETFOCUS, sent }, /* in MDI client */
2847 { HCBT_SETFOCUS, hook },
2848 { WM_KILLFOCUS, sent }, /* in MDI client */
2849 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2850 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2851 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2852 { WM_SETFOCUS, sent },
2853
2854 /* in MDI child */
2855 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2856 { WM_NCCALCSIZE, sent|wparam, 1 },
2857 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2858 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2859
2860 /* in MDI frame */
2861 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2862 { WM_NCCALCSIZE, sent|wparam, 1 },
2863 { 0x0093, sent|defwinproc|optional },
2864 { 0x0093, sent|defwinproc|optional },
2865 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2866 { WM_MOVE, sent|defwinproc },
2867 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2868
2869 /* in MDI client */
2870 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2871 { WM_NCCALCSIZE, sent|wparam, 1 },
2872 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2873 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2874
2875 /* in MDI child */
2876 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2877 { WM_NCCALCSIZE, sent|wparam, 1 },
2878 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE },
2879 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2880
2881 /* in MDI child */
2882 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2883 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2884 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2885 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2886
2887 /* in MDI frame */
2888 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2889 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2890 { 0x0093, sent|defwinproc|optional },
2891 { 0x0093, sent|defwinproc|optional },
2892 { 0x0093, sent|defwinproc|optional },
2893 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2894 { WM_MOVE, sent|defwinproc },
2895 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2896
2897 /* in MDI client */
2898 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2899 { WM_NCCALCSIZE, sent|wparam, 1 },
2900 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2901 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2902
2903 /* in MDI child */
2904 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE },
2905 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2906 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE },
2907 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2908 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2909 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2910
2911 { 0x0093, sent|defwinproc|optional },
2912 { WM_NCCALCSIZE, sent|wparam|defwinproc|optional, 1 }, /* XP sends it to MDI frame */
2913 { 0x0093, sent|defwinproc|optional },
2914 { 0x0093, sent|defwinproc|optional },
2915 { 0x0093, sent|defwinproc|optional },
2916 { 0x0093, sent|optional },
2917
2918 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2919 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2920 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2921 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2922 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
2923
2924 /* in MDI frame */
2925 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2926 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
2927 { 0x0093, sent|defwinproc|optional },
2928 { 0x0093, sent|defwinproc|optional },
2929 { 0x0093, sent|defwinproc|optional },
2930 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2931 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2932 { 0x0093, sent|optional },
2933
2934 { WM_NCACTIVATE, sent|wparam, 0 },
2935 { WM_MDIACTIVATE, sent },
2936
2937 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWNORMAL },
2938 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_STATECHANGED },
2939 { WM_NCCALCSIZE, sent|wparam, 1 },
2940
2941 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2942
2943 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2944 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2945 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2946
2947 /* in MDI child */
2948 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2949 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2950 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2951 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2952
2953 /* in MDI frame */
2954 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2955 { WM_NCCALCSIZE, sent|wparam, 1 },
2956 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2957 { WM_MOVE, sent|defwinproc },
2958 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2959
2960 /* in MDI client */
2961 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2962 { WM_NCCALCSIZE, sent|wparam, 1 },
2963 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2964 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2965 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2966 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP */
2967 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2968 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2969 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
2970
2971 { HCBT_SETFOCUS, hook },
2972 { WM_KILLFOCUS, sent },
2973 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2974 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2975 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2976 { WM_SETFOCUS, sent }, /* in MDI client */
2977
2978 { WM_MDIREFRESHMENU, sent }, /* in MDI client */
2979
2980 { HCBT_DESTROYWND, hook },
2981 /* Win2k sends wparam set to
2982 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2983 * while Win9x doesn't bother to set child window id according to
2984 * CLIENTCREATESTRUCT.idFirstChild
2985 */
2986 { 0x0090, sent|optional },
2987 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2988
2989 { WM_SHOWWINDOW, sent|wparam, 0 },
2990 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2991 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2992 { WM_ERASEBKGND, sent|parent|optional },
2993 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2994
2995 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2996 { WM_DESTROY, sent },
2997 { WM_NCDESTROY, sent },
2998 { 0 }
2999 };
3000 /* ShowWindow(SW_MAXIMIZE) for a not visible MDI child window */
3001 static const struct message WmMaximizeMDIchildInvisibleSeq[] = {
3002 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
3003 { WM_GETMINMAXINFO, sent },
3004 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
3005 { WM_NCCALCSIZE, sent|wparam, 1 },
3006 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
3007 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
3008
3009 { WM_WINDOWPOSCHANGING, sent|wparam|optional|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
3010 { WM_NCACTIVATE, sent|wparam|optional|defwinproc, 1 },
3011 { HCBT_SETFOCUS, hook|optional },
3012 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
3013 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
3014 { WM_SETFOCUS, sent|optional }, /* in MDI client */
3015 { HCBT_SETFOCUS, hook|optional },
3016 { WM_KILLFOCUS, sent|optional }, /* in MDI client */
3017 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */