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