530df4d9df64b41e1ae6c276dfa2f0310685157f
[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 int after_end_dialog, test_def_id;
1723 static int sequence_cnt, sequence_size;
1724 static struct recvd_message* sequence;
1725 static int log_all_parent_messages;
1726 static int paint_loop_done;
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 if (!sequence)
1818 {
1819 sequence_size = 10;
1820 sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof(*sequence) );
1821 }
1822 if (sequence_cnt == sequence_size)
1823 {
1824 sequence_size *= 2;
1825 sequence = HeapReAlloc( GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence) );
1826 }
1827 assert(sequence);
1828
1829 seq = &sequence[sequence_cnt];
1830 seq->hwnd = msg->hwnd;
1831 seq->message = msg->message;
1832 seq->flags = msg->flags;
1833 seq->wParam = msg->wParam;
1834 seq->lParam = msg->lParam;
1835 seq->line = line;
1836 seq->descr = msg->descr;
1837 seq->output[0] = 0;
1838
1839 if (msg->descr)
1840 {
1841 if (msg->flags & hook)
1842 {
1843 static const char * const CBT_code_name[10] =
1844 {
1845 "HCBT_MOVESIZE",
1846 "HCBT_MINMAX",
1847 "HCBT_QS",
1848 "HCBT_CREATEWND",
1849 "HCBT_DESTROYWND",
1850 "HCBT_ACTIVATE",
1851 "HCBT_CLICKSKIPPED",
1852 "HCBT_KEYSKIPPED",
1853 "HCBT_SYSCOMMAND",
1854 "HCBT_SETFOCUS"
1855 };
1856 const char *code_name = (msg->message <= HCBT_SETFOCUS) ? CBT_code_name[msg->message] : "Unknown";
1857
1858 sprintf( seq->output, "%s: hook %d (%s) wp %08lx lp %08lx",
1859 msg->descr, msg->message, code_name, msg->wParam, msg->lParam );
1860 }
1861 else if (msg->flags & winevent_hook)
1862 {
1863 sprintf( seq->output, "%s: winevent %p %08x %08lx %08lx",
1864 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
1865 }
1866 else
1867 {
1868 switch (msg->message)
1869 {
1870 case WM_WINDOWPOSCHANGING:
1871 case WM_WINDOWPOSCHANGED:
1872 {
1873 WINDOWPOS *winpos = (WINDOWPOS *)msg->lParam;
1874
1875 sprintf( seq->output, "%s: %p WM_WINDOWPOS%s wp %08lx lp %08lx after %p x %d y %d cx %d cy %d flags %s",
1876 msg->descr, msg->hwnd,
1877 (msg->message == WM_WINDOWPOSCHANGING) ? "CHANGING" : "CHANGED",
1878 msg->wParam, msg->lParam, winpos->hwndInsertAfter,
1879 winpos->x, winpos->y, winpos->cx, winpos->cy,
1880 get_winpos_flags(winpos->flags) );
1881
1882 /* Log only documented flags, win2k uses 0x1000 and 0x2000
1883 * in the high word for internal purposes
1884 */
1885 seq->wParam = winpos->flags & 0xffff;
1886 /* We are not interested in the flags that don't match under XP and Win9x */
1887 seq->wParam &= ~SWP_NOZORDER;
1888 break;
1889 }
1890
1891 case WM_DRAWITEM:
1892 {
1893 DRAW_ITEM_STRUCT di;
1894 DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)msg->lParam;
1895
1896 sprintf( seq->output, "%s: %p WM_DRAWITEM: type %x, ctl_id %x, item_id %x, action %x, state %x",
1897 msg->descr, msg->hwnd, dis->CtlType, dis->CtlID,
1898 dis->itemID, dis->itemAction, dis->itemState);
1899
1900 di.u.lp = 0;
1901 di.u.item.type = dis->CtlType;
1902 di.u.item.ctl_id = dis->CtlID;
1903 if (dis->CtlType == ODT_LISTBOX ||
1904 dis->CtlType == ODT_COMBOBOX ||
1905 dis->CtlType == ODT_MENU)
1906 di.u.item.item_id = dis->itemID;
1907 di.u.item.action = dis->itemAction;
1908 di.u.item.state = dis->itemState;
1909
1910 seq->lParam = di.u.lp;
1911 break;
1912 }
1913 default:
1914 if (msg->message >= 0xc000) return; /* ignore registered messages */
1915 sprintf( seq->output, "%s: %p %04x wp %08lx lp %08lx",
1916 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
1917 }
1918 if (msg->flags & (sent|posted|parent|defwinproc|beginpaint))
1919 sprintf( seq->output + strlen(seq->output), " (flags %x)", msg->flags );
1920 }
1921 }
1922
1923 sequence_cnt++;
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 HeapFree(GetProcessHeap(), 0, sequence);
1945 sequence = 0;
1946 sequence_cnt = sequence_size = 0;
1947 }
1948
1949 static void dump_sequence(const struct message *expected, const char *context, const char *file, int line)
1950 {
1951 const struct recvd_message *actual = sequence;
1952 unsigned int count = 0;
1953
1954 trace_(file, line)("Failed sequence %s:\n", context );
1955 while (expected->message && actual->message)
1956 {
1957 if (actual->output[0])
1958 {
1959 if (expected->flags & hook)
1960 {
1961 trace_(file, line)( " %u: expected: hook %04x - actual: %s\n",
1962 count, expected->message, actual->output );
1963 }
1964 else if (expected->flags & winevent_hook)
1965 {
1966 trace_(file, line)( " %u: expected: winevent %04x - actual: %s\n",
1967 count, expected->message, actual->output );
1968 }
1969 else if (expected->flags & kbd_hook)
1970 {
1971 trace_(file, line)( " %u: expected: kbd %04x - actual: %s\n",
1972 count, expected->message, actual->output );
1973 }
1974 else
1975 {
1976 trace_(file, line)( " %u: expected: msg %04x - actual: %s\n",
1977 count, expected->message, actual->output );
1978 }
1979 }
1980
1981 if (expected->message == actual->message)
1982 {
1983 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) &&
1984 (expected->flags & optional))
1985 {
1986 /* don't match messages if their defwinproc status differs */
1987 expected++;
1988 }
1989 else
1990 {
1991 expected++;
1992 actual++;
1993 }
1994 }
1995 /* silently drop winevent messages if there is no support for them */
1996 else if ((expected->flags & optional) || ((expected->flags & winevent_hook) && !hEvent_hook))
1997 expected++;
1998 else
1999 {
2000 expected++;
2001 actual++;
2002 }
2003 count++;
2004 }
2005
2006 /* optional trailing messages */
2007 while (expected->message && ((expected->flags & optional) ||
2008 ((expected->flags & winevent_hook) && !hEvent_hook)))
2009 {
2010 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
2011 expected++;
2012 count++;
2013 }
2014
2015 if (expected->message)
2016 {
2017 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
2018 return;
2019 }
2020
2021 while (actual->message && actual->output[0])
2022 {
2023 trace_(file, line)( " %u: expected: nothing - actual: %s\n", count, actual->output );
2024 actual++;
2025 count++;
2026 }
2027 }
2028
2029 #define ok_sequence( exp, contx, todo) \
2030 ok_sequence_( (exp), (contx), (todo), __FILE__, __LINE__)
2031
2032
2033 static void ok_sequence_(const struct message *expected_list, const char *context, int todo,
2034 const char *file, int line)
2035 {
2036 static const struct recvd_message end_of_sequence;
2037 const struct message *expected = expected_list;
2038 const struct recvd_message *actual;
2039 int failcount = 0, dump = 0;
2040 unsigned int count = 0;
2041
2042 add_message(&end_of_sequence);
2043
2044 actual = sequence;
2045
2046 while (expected->message && actual->message)
2047 {
2048 if (expected->message == actual->message &&
2049 !((expected->flags ^ actual->flags) & (hook|winevent_hook|kbd_hook)))
2050 {
2051 if (expected->flags & wparam)
2052 {
2053 if (((expected->wParam ^ actual->wParam) & ~expected->wp_mask) && todo)
2054 {
2055 todo_wine {
2056 failcount ++;
2057 if (strcmp(winetest_platform, "wine")) dump++;
2058 ok_( file, line) (FALSE,
2059 "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
2060 context, count, expected->message, expected->wParam, actual->wParam);
2061 }
2062 }
2063 else
2064 {
2065 ok_( file, line)( ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) == 0,
2066 "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
2067 context, count, expected->message, expected->wParam, actual->wParam);
2068 if ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) dump++;
2069 }
2070
2071 }
2072 if (expected->flags & lparam)
2073 {
2074 if (((expected->lParam ^ actual->lParam) & ~expected->lp_mask) && todo)
2075 {
2076 todo_wine {
2077 failcount ++;
2078 if (strcmp(winetest_platform, "wine")) dump++;
2079 ok_( file, line) (FALSE,
2080 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
2081 context, count, expected->message, expected->lParam, actual->lParam);
2082 }
2083 }
2084 else
2085 {
2086 ok_( file, line)(((expected->lParam ^ actual->lParam) & ~expected->lp_mask) == 0,
2087 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
2088 context, count, expected->message, expected->lParam, actual->lParam);
2089 if ((expected->lParam ^ actual->lParam) & ~expected->lp_mask) dump++;
2090 }
2091 }
2092 if ((expected->flags & optional) &&
2093 ((expected->flags ^ actual->flags) & (defwinproc|parent)))
2094 {
2095 /* don't match optional messages if their defwinproc or parent status differs */
2096 expected++;
2097 count++;
2098 continue;
2099 }
2100 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
2101 {
2102 todo_wine {
2103 failcount ++;
2104 if (strcmp(winetest_platform, "wine")) dump++;
2105 ok_( file, line) (FALSE,
2106 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
2107 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
2108 }
2109 }
2110 else
2111 {
2112 ok_( file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
2113 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
2114 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
2115 if ((expected->flags & defwinproc) != (actual->flags & defwinproc)) dump++;
2116 }
2117
2118 ok_( file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
2119 "%s: %u: the msg 0x%04x should %shave been sent by BeginPaint\n",
2120 context, count, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
2121 if ((expected->flags & beginpaint) != (actual->flags & beginpaint)) dump++;
2122
2123 ok_( file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
2124 "%s: %u: the msg 0x%04x should have been %s\n",
2125 context, count, expected->message, (expected->flags & posted) ? "posted" : "sent");
2126 if ((expected->flags & (sent|posted)) != (actual->flags & (sent|posted))) dump++;
2127
2128 ok_( file, line) ((expected->flags & parent) == (actual->flags & parent),
2129 "%s: %u: the msg 0x%04x was expected in %s\n",
2130 context, count, expected->message, (expected->flags & parent) ? "parent" : "child");
2131 if ((expected->flags & parent) != (actual->flags & parent)) dump++;
2132
2133 ok_( file, line) ((expected->flags & hook) == (actual->flags & hook),
2134 "%s: %u: the msg 0x%04x should have been sent by a hook\n",
2135 context, count, expected->message);
2136 if ((expected->flags & hook) != (actual->flags & hook)) dump++;
2137
2138 ok_( file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
2139 "%s: %u: the msg 0x%04x should have been sent by a winevent hook\n",
2140 context, count, expected->message);
2141 if ((expected->flags & winevent_hook) != (actual->flags & winevent_hook)) dump++;
2142
2143 ok_( file, line) ((expected->flags & kbd_hook) == (actual->flags & kbd_hook),
2144 "%s: %u: the msg 0x%04x should have been sent by a keyboard hook\n",
2145 context, count, expected->message);
2146 if ((expected->flags & kbd_hook) != (actual->flags & kbd_hook)) dump++;
2147
2148 expected++;
2149 actual++;
2150 }
2151 /* silently drop hook messages if there is no support for them */
2152 else if ((expected->flags & optional) ||
2153 ((expected->flags & hook) && !hCBT_hook) ||
2154 ((expected->flags & winevent_hook) && !hEvent_hook) ||
2155 ((expected->flags & kbd_hook) && !hKBD_hook))
2156 expected++;
2157 else if (todo)
2158 {
2159 failcount++;
2160 todo_wine {
2161 if (strcmp(winetest_platform, "wine")) dump++;
2162 ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
2163 context, count, expected->message, actual->message);
2164 }
2165 goto done;
2166 }
2167 else
2168 {
2169 ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
2170 context, count, expected->message, actual->message);
2171 dump++;
2172 expected++;
2173 actual++;
2174 }
2175 count++;
2176 }
2177
2178 /* skip all optional trailing messages */
2179 while (expected->message && ((expected->flags & optional) ||
2180 ((expected->flags & hook) && !hCBT_hook) ||
2181 ((expected->flags & winevent_hook) && !hEvent_hook)))
2182 expected++;
2183
2184 if (todo)
2185 {
2186 todo_wine {
2187 if (expected->message || actual->message) {
2188 failcount++;
2189 if (strcmp(winetest_platform, "wine")) dump++;
2190 ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
2191 context, count, expected->message, actual->message);
2192 }
2193 }
2194 }
2195 else
2196 {
2197 if (expected->message || actual->message)
2198 {
2199 dump++;
2200 ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
2201 context, count, expected->message, actual->message);
2202 }
2203 }
2204 if( todo && !failcount) /* succeeded yet marked todo */
2205 todo_wine {
2206 if (!strcmp(winetest_platform, "wine")) dump++;
2207 ok_( file, line)( TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
2208 }
2209
2210 done:
2211 if (dump) dump_sequence(expected_list, context, file, line);
2212 flush_sequence();
2213 }
2214
2215 #define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
2216
2217 /******************************** MDI test **********************************/
2218
2219 /* CreateWindow for MDI frame window, initially visible */
2220 static const struct message WmCreateMDIframeSeq[] = {
2221 { HCBT_CREATEWND, hook },
2222 { WM_GETMINMAXINFO, sent },
2223 { WM_NCCREATE, sent },
2224 { WM_NCCALCSIZE, sent|wparam, 0 },
2225 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
2226 { WM_CREATE, sent },
2227 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2228 { WM_NOTIFYFORMAT, sent|optional },
2229 { WM_QUERYUISTATE, sent|optional },
2230 { WM_WINDOWPOSCHANGING, sent|optional },
2231 { WM_GETMINMAXINFO, sent|optional },
2232 { WM_NCCALCSIZE, sent|optional },
2233 { WM_WINDOWPOSCHANGED, sent|optional },
2234 { WM_SHOWWINDOW, sent|wparam, 1 },
2235 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2236 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2237 { HCBT_ACTIVATE, hook },
2238 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
2239 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
2240 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* XP */
2241 { WM_ACTIVATEAPP, sent|wparam|optional, 1 }, /* Win9x doesn't send it */
2242 { WM_NCACTIVATE, sent },
2243 { WM_GETTEXT, sent|defwinproc|optional },
2244 { WM_ACTIVATE, sent|wparam, 1 },
2245 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* Win9x */
2246 { HCBT_SETFOCUS, hook },
2247 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2248 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
2249 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2250 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
2251 /* Win9x adds SWP_NOZORDER below */
2252 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2253 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP */
2254 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
2255 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2256 { WM_MOVE, sent },
2257 { 0 }
2258 };
2259 /* DestroyWindow for MDI frame window, initially visible */
2260 static const struct message WmDestroyMDIframeSeq[] = {
2261 { HCBT_DESTROYWND, hook },
2262 { 0x0090, sent|optional },
2263 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2264 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2265 { WM_NCACTIVATE, sent|wparam|optional, 0 }, /* Win9x */
2266 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2267 { WM_NCACTIVATE, sent|wparam|optional, 0 }, /* XP */
2268 { WM_ACTIVATE, sent|wparam|optional, 0 }, /* Win9x */
2269 { WM_ACTIVATEAPP, sent|wparam|optional, 0 }, /* Win9x */
2270 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, OBJID_CARET, 0 },
2271 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2272 { WM_DESTROY, sent },
2273 { WM_NCDESTROY, sent },
2274 { 0 }
2275 };
2276 /* CreateWindow for MDI client window, initially visible */
2277 static const struct message WmCreateMDIclientSeq[] = {
2278 { HCBT_CREATEWND, hook },
2279 { WM_NCCREATE, sent },
2280 { WM_NCCALCSIZE, sent|wparam, 0 },
2281 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2282 { WM_CREATE, sent },
2283 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2284 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2285 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2286 { WM_MOVE, sent },
2287 { WM_PARENTNOTIFY, sent|wparam, WM_CREATE }, /* in MDI frame */
2288 { WM_SHOWWINDOW, sent|wparam, 1 },
2289 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2290 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2291 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2292 { 0 }
2293 };
2294 /* ShowWindow(SW_SHOW) for MDI client window */
2295 static const struct message WmShowMDIclientSeq[] = {
2296 { WM_SHOWWINDOW, sent|wparam, 1 },
2297 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2298 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2299 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2300 { 0 }
2301 };
2302 /* ShowWindow(SW_HIDE) for MDI client window */
2303 static const struct message WmHideMDIclientSeq[] = {
2304 { WM_SHOWWINDOW, sent|wparam, 0 },
2305 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2306 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam|optional, 0, 0 }, /* win2000 */
2307 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP */
2308 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2309 { 0 }
2310 };
2311 /* DestroyWindow for MDI client window, initially visible */
2312 static const struct message WmDestroyMDIclientSeq[] = {
2313 { HCBT_DESTROYWND, hook },
2314 { 0x0090, sent|optional },
2315 { WM_PARENTNOTIFY, sent|wparam, WM_DESTROY }, /* in MDI frame */
2316 { WM_SHOWWINDOW, sent|wparam, 0 },
2317 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2318 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2319 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2320 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2321 { WM_DESTROY, sent },
2322 { WM_NCDESTROY, sent },
2323 { 0 }
2324 };
2325 /* CreateWindow for MDI child window, initially visible */
2326 static const struct message WmCreateMDIchildVisibleSeq[] = {
2327 { HCBT_CREATEWND, hook },
2328 { WM_NCCREATE, sent },
2329 { WM_NCCALCSIZE, sent|wparam, 0 },
2330 { WM_CREATE, sent },
2331 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2332 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2333 { WM_MOVE, sent },
2334 /* Win2k sends wparam set to
2335 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2336 * while Win9x doesn't bother to set child window id according to
2337 * CLIENTCREATESTRUCT.idFirstChild
2338 */
2339 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2340 { WM_SHOWWINDOW, sent|wparam, 1 },
2341 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2342 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2343 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2344 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2345 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2346 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2347 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2348
2349 /* Win9x: message sequence terminates here. */
2350
2351 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2352 { HCBT_SETFOCUS, hook }, /* in MDI client */
2353 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2354 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2355 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2356 { WM_SETFOCUS, sent }, /* in MDI client */
2357 { HCBT_SETFOCUS, hook },
2358 { WM_KILLFOCUS, sent }, /* in MDI client */
2359 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2360 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2361 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2362 { WM_SETFOCUS, sent|defwinproc },
2363 { WM_MDIACTIVATE, sent|defwinproc },
2364 { 0 }
2365 };
2366 /* CreateWindow for MDI child window with invisible parent */
2367 static const struct message WmCreateMDIchildInvisibleParentSeq[] = {
2368 { HCBT_CREATEWND, hook },
2369 { WM_GETMINMAXINFO, sent },
2370 { WM_NCCREATE, sent },
2371 { WM_NCCALCSIZE, sent|wparam, 0 },
2372 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2373 { WM_CREATE, sent },
2374 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2375 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2376 { WM_MOVE, sent },
2377 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2378 { WM_SHOWWINDOW, sent|wparam, 1 },
2379 { WM_MDIREFRESHMENU, sent }, /* in MDI client */
2380 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2381 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2382 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2383
2384 /* Win9x: message sequence terminates here. */
2385
2386 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2387 { HCBT_SETFOCUS, hook }, /* in MDI client */
2388 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2389 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2390 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2391 { WM_SETFOCUS, sent }, /* in MDI client */
2392 { HCBT_SETFOCUS, hook },
2393 { WM_KILLFOCUS, sent }, /* in MDI client */
2394 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2395 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2396 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2397 { WM_SETFOCUS, sent|defwinproc },
2398 { WM_MDIACTIVATE, sent|defwinproc },
2399 { 0 }
2400 };
2401 /* DestroyWindow for MDI child window, initially visible */
2402 static const struct message WmDestroyMDIchildVisibleSeq[] = {
2403 { HCBT_DESTROYWND, hook },
2404 /* Win2k sends wparam set to
2405 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2406 * while Win9x doesn't bother to set child window id according to
2407 * CLIENTCREATESTRUCT.idFirstChild
2408 */
2409 { 0x0090, sent|optional },
2410 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2411 { WM_SHOWWINDOW, sent|wparam, 0 },
2412 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2413 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2414 { WM_ERASEBKGND, sent|parent|optional },
2415 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2416
2417 /* { WM_DESTROY, sent }
2418 * Win9x: message sequence terminates here.
2419 */
2420
2421 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2422 { WM_KILLFOCUS, sent },
2423 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2424 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2425 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2426 { WM_SETFOCUS, sent }, /* in MDI client */
2427
2428 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2429 { WM_KILLFOCUS, sent }, /* in MDI client */
2430 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2431 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2432 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2433 { WM_SETFOCUS, sent }, /* in MDI client */
2434
2435 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2436
2437 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2438 { WM_KILLFOCUS, sent },
2439 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2440 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2441 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2442 { WM_SETFOCUS, sent }, /* in MDI client */
2443
2444 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2445 { WM_KILLFOCUS, sent }, /* in MDI client */
2446 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2447 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2448 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2449 { WM_SETFOCUS, sent }, /* in MDI client */
2450
2451 { WM_DESTROY, sent },
2452
2453 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2454 { WM_KILLFOCUS, sent },
2455 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2456 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2457 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2458 { WM_SETFOCUS, sent }, /* in MDI client */
2459
2460 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2461 { WM_KILLFOCUS, sent }, /* in MDI client */
2462 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2463 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2464 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2465 { WM_SETFOCUS, sent }, /* in MDI client */
2466
2467 { WM_NCDESTROY, sent },
2468 { 0 }
2469 };
2470 /* CreateWindow for MDI child window, initially invisible */
2471 static const struct message WmCreateMDIchildInvisibleSeq[] = {
2472 { HCBT_CREATEWND, hook },
2473 { WM_NCCREATE, sent },
2474 { WM_NCCALCSIZE, sent|wparam, 0 },
2475 { WM_CREATE, sent },
2476 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2477 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2478 { WM_MOVE, sent },
2479 /* Win2k sends wparam set to
2480 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2481 * while Win9x doesn't bother to set child window id according to
2482 * CLIENTCREATESTRUCT.idFirstChild
2483 */
2484 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2485 { 0 }
2486 };
2487 /* DestroyWindow for MDI child window, initially invisible */
2488 static const struct message WmDestroyMDIchildInvisibleSeq[] = {
2489 { HCBT_DESTROYWND, hook },
2490 /* Win2k sends wparam set to
2491 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2492 * while Win9x doesn't bother to set child window id according to
2493 * CLIENTCREATESTRUCT.idFirstChild
2494 */
2495 { 0x0090, sent|optional },
2496 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2497 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2498 { WM_DESTROY, sent },
2499 { WM_NCDESTROY, sent },
2500 /* FIXME: Wine destroys an icon/title window while Windows doesn't */
2501 { WM_PARENTNOTIFY, sent|wparam|optional, WM_DESTROY }, /* MDI client */
2502 { 0 }
2503 };
2504 /* CreateWindow for the 1st MDI child window, initially visible and maximized */
2505 static const struct message WmCreateMDIchildVisibleMaxSeq1[] = {
2506 { HCBT_CREATEWND, hook },
2507 { WM_NCCREATE, sent },
2508 { WM_NCCALCSIZE, sent|wparam, 0 },
2509 { WM_CREATE, sent },
2510 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2511 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2512 { WM_MOVE, sent },
2513 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2514 { WM_GETMINMAXINFO, sent },
2515 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2516 { WM_NCCALCSIZE, sent|wparam, 1 },
2517 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2518 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2519 /* in MDI frame */
2520 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2521 { WM_NCCALCSIZE, sent|wparam, 1 },
2522 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2523 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2524 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2525 /* Win2k sends wparam set to
2526 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2527 * while Win9x doesn't bother to set child window id according to
2528 * CLIENTCREATESTRUCT.idFirstChild
2529 */
2530 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2531 { WM_SHOWWINDOW, sent|wparam, 1 },
2532 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2533 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2534 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2535 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2536 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2537 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2538 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc|optional, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE, 0, SWP_FRAMECHANGED },
2539
2540 /* Win9x: message sequence terminates here. */
2541
2542 { WM_NCACTIVATE, sent|wparam|defwinproc|optional, 1 },
2543 { HCBT_SETFOCUS, hook|optional }, /* in MDI client */
2544 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2545 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2546 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2547 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2548 { HCBT_SETFOCUS, hook|optional },
2549 { WM_KILLFOCUS, sent|optional }, /* in MDI client */
2550 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2551 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2552 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2553 { WM_SETFOCUS, sent|defwinproc|optional },
2554 { WM_MDIACTIVATE, sent|defwinproc|optional },
2555 /* in MDI frame */
2556 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2557 { WM_NCCALCSIZE, sent|wparam, 1 },
2558 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2559 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2560 { 0 }
2561 };
2562 /* CreateWindow for the 2nd MDI child window, initially visible and maximized */
2563 static const struct message WmCreateMDIchildVisibleMaxSeq2[] = {
2564 /* restore the 1st MDI child */
2565 { WM_SETREDRAW, sent|wparam, 0 },
2566 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWNORMAL },
2567 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
2568 { WM_NCCALCSIZE, sent|wparam, 1 },
2569 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2570 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2571 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2572 /* in MDI frame */
2573 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2574 { WM_NCCALCSIZE, sent|wparam, 1 },
2575 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2576 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2577 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2578 { WM_SETREDRAW, sent|wparam, 1 }, /* in the 1st MDI child */
2579 /* create the 2nd MDI child */
2580 { HCBT_CREATEWND, hook },
2581 { WM_NCCREATE, sent },
2582 { WM_NCCALCSIZE, sent|wparam, 0 },
2583 { WM_CREATE, sent },
2584 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2585 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2586 { WM_MOVE, sent },
2587 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2588 { WM_GETMINMAXINFO, sent },
2589 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2590 { WM_NCCALCSIZE, sent|wparam, 1 },
2591 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2592 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2593 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2594 /* in MDI frame */
2595 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2596 { WM_NCCALCSIZE, sent|wparam, 1 },
2597 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2598 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2599 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2600 /* Win2k sends wparam set to
2601 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2602 * while Win9x doesn't bother to set child window id according to
2603 * CLIENTCREATESTRUCT.idFirstChild
2604 */
2605 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2606 { WM_SHOWWINDOW, sent|wparam, 1 },
2607 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2608 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2609 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2610 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2611 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2612 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2613
2614 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
2615 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
2616
2617 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2618
2619 /* Win9x: message sequence terminates here. */
2620
2621 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2622 { HCBT_SETFOCUS, hook },
2623 { WM_KILLFOCUS, sent|defwinproc|optional }, /* in the 1st MDI child */
2624 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 }, /* in the 1st MDI child */
2625 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2626 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2627 { WM_SETFOCUS, sent }, /* in MDI client */
2628 { HCBT_SETFOCUS, hook },
2629 { WM_KILLFOCUS, sent }, /* in MDI client */
2630 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2631 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2632 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2633 { WM_SETFOCUS, sent|defwinproc },
2634
2635 { WM_MDIACTIVATE, sent|defwinproc },
2636 /* in MDI frame */
2637 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2638 { WM_NCCALCSIZE, sent|wparam, 1 },
2639 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2640 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2641 { 0 }
2642 };
2643 /* WM_MDICREATE MDI child window, initially visible and maximized */
2644 static const struct message WmCreateMDIchildVisibleMaxSeq3[] = {
2645 { WM_MDICREATE, sent },
2646 { HCBT_CREATEWND, hook },
2647 { WM_NCCREATE, sent },
2648 { WM_NCCALCSIZE, sent|wparam, 0 },
2649 { WM_CREATE, sent },
2650 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2651 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2652 { WM_MOVE, sent },
2653 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2654 { WM_GETMINMAXINFO, sent },
2655 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2656 { WM_NCCALCSIZE, sent|wparam, 1 },
2657 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2658 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2659
2660 /* in MDI frame */
2661 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2662 { WM_NCCALCSIZE, sent|wparam, 1 },
2663 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2664 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2665 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2666
2667 /* Win2k sends wparam set to
2668 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2669 * while Win9x doesn't bother to set child window id according to
2670 * CLIENTCREATESTRUCT.idFirstChild
2671 */
2672 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2673 { WM_SHOWWINDOW, sent|wparam, 1 },
2674 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2675
2676 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2677
2678 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2679 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2680 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2681
2682 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2683 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2684
2685 /* Win9x: message sequence terminates here. */
2686
2687 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2688 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2689 { HCBT_SETFOCUS, hook }, /* in MDI client */
2690 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2691 { WM_IME_NOTIFY, sent|wparam|optional, 2 },
2692 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
2693 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2694 { HCBT_SETFOCUS, hook|optional },
2695 { WM_KILLFOCUS, sent }, /* in MDI client */
2696 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2697 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2698 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2699 { WM_SETFOCUS, sent|defwinproc },
2700
2701 { WM_MDIACTIVATE, sent|defwinproc },
2702
2703 /* in MDI child */
2704 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2705 { WM_NCCALCSIZE, sent|wparam, 1 },
2706 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2707 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
2708
2709 /* in MDI frame */
2710 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2711 { WM_NCCALCSIZE, sent|wparam, 1 },
2712 { 0x0093, sent|defwinproc|optional },
2713 { 0x0093, sent|defwinproc|optional },
2714 { 0x0093, sent|defwinproc|optional },
2715 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2716 { WM_MOVE, sent|defwinproc },
2717 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2718
2719 /* in MDI client */
2720 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2721 { WM_NCCALCSIZE, sent|wparam, 1 },
2722 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2723 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2724
2725 /* in MDI child */
2726 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2727 { WM_NCCALCSIZE, sent|wparam, 1 },
2728 { 0x0093, sent|optional },
2729 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2730 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2731
2732 { 0x0093, sent|optional },
2733 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2734 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2735 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP sends it to MDI frame */
2736 { 0x0093, sent|defwinproc|optional },
2737 { 0x0093, sent|defwinproc|optional },
2738 { 0x0093, sent|defwinproc|optional },
2739 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2740 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
2741
2742 { 0 }
2743 };
2744 /* CreateWindow for the 1st MDI child window, initially invisible and maximized */
2745 static const struct message WmCreateMDIchildInvisibleMaxSeq4[] = {
2746 { HCBT_CREATEWND, hook },
2747 { WM_GETMINMAXINFO, sent },
2748 { WM_NCCREATE, sent },
2749 { WM_NCCALCSIZE, sent|wparam, 0 },
2750 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
2751 { WM_CREATE, sent },
2752 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2753 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2754 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE, 0, SWP_NOZORDER }, /* MDI frame */
2755 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* MDI frame */
2756 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE, 0, SWP_NOZORDER }, /* MDI frame */
2757 { WM_MOVE, sent },
2758 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2759 { WM_GETMINMAXINFO, sent },
2760 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2761 { WM_GETMINMAXINFO, sent|defwinproc },
2762 { WM_NCCALCSIZE, sent|wparam, 1 },
2763 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_STATECHANGED },
2764 { WM_MOVE, sent|defwinproc },
2765 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2766 /* in MDI frame */
2767 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2768 { WM_NCCALCSIZE, sent|wparam, 1 },
2769 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2770 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2771 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* MDI child */
2772 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2773 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2774 /* Win2k sends wparam set to
2775 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2776 * while Win9x doesn't bother to set child window id according to
2777 * CLIENTCREATESTRUCT.idFirstChild
2778 */
2779 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2780 { 0 }
2781 };
2782 /* WM_SYSCOMMAND/SC_CLOSE for the 2nd MDI child window, initially visible and maximized */
2783 static const struct message WmDestroyMDIchildVisibleMaxSeq2[] = {
2784 { WM_SYSCOMMAND, sent|wparam, SC_CLOSE },
2785 { HCBT_SYSCOMMAND, hook },
2786 { WM_CLOSE, sent|defwinproc },
2787 { WM_MDIDESTROY, sent }, /* in MDI client */
2788
2789 /* bring the 1st MDI child to top */
2790 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOSIZE|SWP_NOMOVE }, /* in the 1st MDI child */
2791 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, /* in the 2nd MDI child */
2792
2793 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2794
2795 { WM_CHILDACTIVATE, sent|defwinproc|wparam|lparam, 0, 0 }, /* in the 1st MDI child */
2796 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
2797 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
2798
2799 /* maximize the 1st MDI child */
2800 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2801 { WM_GETMINMAXINFO, sent|defwinproc },
2802 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_STATECHANGED },
2803 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
2804 { WM_CHILDACTIVATE, sent|defwinproc|wparam|lparam, 0, 0 },
2805 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2806 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2807
2808 /* restore the 2nd MDI child */
2809 { WM_SETREDRAW, sent|defwinproc|wparam, 0 },
2810 { HCBT_MINMAX, hook|lparam, 0, SW_NORMALNA },
2811 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_STATECHANGED },
2812 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
2813
2814 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2815
2816 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2817 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2818
2819 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2820
2821 { WM_SETREDRAW, sent|defwinproc|wparam, 1 },
2822 /* in MDI frame */
2823 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2824 { WM_NCCALCSIZE, sent|wparam, 1 },
2825 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2826 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2827 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2828
2829 /* bring the 1st MDI child to top */
2830 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2831 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2832 { HCBT_SETFOCUS, hook },
2833 { WM_KILLFOCUS, sent|defwinproc },
2834 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 },
2835 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2836 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2837 { WM_SETFOCUS, sent }, /* in MDI client */
2838 { HCBT_SETFOCUS, hook },
2839 { WM_KILLFOCUS, sent }, /* in MDI client */
2840 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2841 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2842 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2843 { WM_SETFOCUS, sent|defwinproc },
2844 { WM_MDIACTIVATE, sent|defwinproc },
2845 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2846
2847 /* apparently ShowWindow(SW_SHOW) on an MDI client */
2848 { WM_SHOWWINDOW, sent|wparam, 1 },
2849 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2850 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2851 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2852 { WM_MDIREFRESHMENU, sent },
2853
2854 { HCBT_DESTROYWND, hook },
2855 /* Win2k sends wparam set to
2856 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2857 * while Win9x doesn't bother to set child window id according to
2858 * CLIENTCREATESTRUCT.idFirstChild
2859 */
2860 { 0x0090, sent|defwinproc|optional },
2861 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2862 { WM_SHOWWINDOW, sent|defwinproc|wparam, 0 },
2863 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2864 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2865 { WM_ERASEBKGND, sent|parent|optional },
2866 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2867
2868 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2869 { WM_DESTROY, sent|defwinproc },
2870 { WM_NCDESTROY, sent|defwinproc },
2871 { 0 }
2872 };
2873 /* WM_MDIDESTROY for the single MDI child window, initially visible and maximized */
2874 static const struct message WmDestroyMDIchildVisibleMaxSeq1[] = {
2875 { WM_MDIDESTROY, sent }, /* in MDI client */
2876 { WM_SHOWWINDOW, sent|wparam, 0 },
2877 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2878 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2879 { WM_ERASEBKGND, sent|parent|optional },
2880 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2881
2882 { HCBT_SETFOCUS, hook },
2883 { WM_KILLFOCUS, sent },
2884 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2885 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2886 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2887 { WM_SETFOCUS, sent }, /* in MDI client */
2888 { HCBT_SETFOCUS, hook },
2889 { WM_KILLFOCUS, sent }, /* in MDI client */
2890 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2891 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2892 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2893 { WM_SETFOCUS, sent },
2894
2895 /* in MDI child */
2896 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2897 { WM_NCCALCSIZE, sent|wparam, 1 },
2898 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2899 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2900
2901 /* in MDI frame */
2902 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2903 { WM_NCCALCSIZE, sent|wparam, 1 },
2904 { 0x0093, sent|defwinproc|optional },
2905 { 0x0093, sent|defwinproc|optional },
2906 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2907 { WM_MOVE, sent|defwinproc },
2908 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2909
2910 /* in MDI client */
2911 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2912 { WM_NCCALCSIZE, sent|wparam, 1 },
2913 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2914 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2915
2916 /* in MDI child */
2917 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2918 { WM_NCCALCSIZE, sent|wparam, 1 },
2919 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE },
2920 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2921
2922 /* in MDI child */
2923 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2924 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2925 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2926 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2927
2928 /* in MDI frame */
2929 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2930 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2931 { 0x0093, sent|defwinproc|optional },
2932 { 0x0093, sent|defwinproc|optional },
2933 { 0x0093, sent|defwinproc|optional },
2934 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2935 { WM_MOVE, sent|defwinproc },
2936 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2937
2938 /* in MDI client */
2939 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
2940 { WM_NCCALCSIZE, sent|wparam, 1 },
2941 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
2942 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2943
2944 /* in MDI child */
2945 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE },
2946 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2947 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE },
2948 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2949 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2950 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2951
2952 { 0x0093, sent|defwinproc|optional },
2953 { WM_NCCALCSIZE, sent|wparam|defwinproc|optional, 1 }, /* XP sends it to MDI frame */
2954 { 0x0093, sent|defwinproc|optional },
2955 { 0x0093, sent|defwinproc|optional },
2956 { 0x0093, sent|defwinproc|optional },
2957 { 0x0093, sent|optional },
2958
2959 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2960 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2961 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
2962 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2963 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
2964
2965 /* in MDI frame */
2966 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2967 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
2968 { 0x0093, sent|defwinproc|optional },
2969 { 0x0093, sent|defwinproc|optional },
2970 { 0x0093, sent|defwinproc|optional },
2971 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2972 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2973 { 0x0093, sent|optional },
2974
2975 { WM_NCACTIVATE, sent|wparam, 0 },
2976 { WM_MDIACTIVATE, sent },
2977
2978 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWNORMAL },
2979 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_STATECHANGED },
2980 { WM_NCCALCSIZE, sent|wparam, 1 },
2981
2982 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2983
2984 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2985 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2986 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2987
2988 /* in MDI child */
2989 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2990 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },
2991 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2992 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2993
2994 /* in MDI frame */
2995 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2996 { WM_NCCALCSIZE, sent|wparam, 1 },
2997 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2998 { WM_MOVE, sent|defwinproc },
2999 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
3000
3001 /* in MDI client */
3002 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
3003 { WM_NCCALCSIZE, sent|wparam, 1 },
3004 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
3005 { WM_SIZE, sent|wparam, SIZE_RESTORED },
3006 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
3007 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP */
3008 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI client */
3009 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
3010 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* XP sends a duplicate */
3011
3012 { HCBT_SETFOCUS, hook },
3013 { WM_KILLFOCUS, sent },
3014 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
3015 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
3016 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
3017 { WM_SETFOCUS, sent }, /* in MDI client */
3018
3019 { WM_MDIREFRESHMENU, sent }, /* in MDI client */
3020
3021