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