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