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