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