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