2003-10-02 04:32:56 +00:00
|
|
|
/*
|
|
|
|
* Unit tests for window message handling
|
|
|
|
*
|
|
|
|
* Copyright 1999 Ove Kaaven
|
|
|
|
* Copyright 2003 Dimitrie O. Paun
|
2004-03-25 23:35:52 +00:00
|
|
|
* Copyright 2004 Dmitry Timoshkov
|
2003-10-02 04:32:56 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
FIXME: add tests for these
|
|
|
|
Window Edge Styles (Win31/Win95/98 look), in order of precedence:
|
|
|
|
WS_EX_DLGMODALFRAME: double border, WS_CAPTION allowed
|
|
|
|
WS_THICKFRAME: thick border
|
|
|
|
WS_DLGFRAME: double border, WS_CAPTION not allowed (but possibly shown anyway)
|
|
|
|
WS_BORDER (default for overlapped windows): single black border
|
|
|
|
none (default for child (and popup?) windows): no border
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
sent=0x1, posted=0x2, parent=0x4, wparam=0x8, lparam=0x10,
|
2004-03-26 00:18:20 +00:00
|
|
|
defwinproc=0x20, optional=0x40, hook=0x80
|
2003-10-02 04:32:56 +00:00
|
|
|
} msg_flags_t;
|
|
|
|
|
|
|
|
struct message {
|
|
|
|
UINT message; /* the WM_* code */
|
|
|
|
msg_flags_t flags; /* message props */
|
2004-03-25 23:35:52 +00:00
|
|
|
WPARAM wParam; /* expected value of wParam */
|
|
|
|
LPARAM lParam; /* expected value of lParam */
|
2003-10-02 04:32:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* CreateWindow (for overlapped window, not initially visible) (16/32) */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmCreateOverlappedSeq[] = {
|
2004-03-26 00:18:20 +00:00
|
|
|
{ HCBT_CREATEWND, hook },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_GETMINMAXINFO, sent },
|
|
|
|
{ WM_NCCREATE, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 0 },
|
|
|
|
{ WM_CREATE, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
2004-05-10 19:59:20 +00:00
|
|
|
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
|
|
|
|
* for a not visible overlapped window.
|
|
|
|
*/
|
|
|
|
static const struct message WmSWP_ShowOverlappedSeq[] = {
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCPAINT, sent|wparam|optional, 1 },
|
|
|
|
{ WM_GETTEXT, sent|defwinproc|optional },
|
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
|
|
|
{ HCBT_ACTIVATE, hook },
|
|
|
|
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, 0 }, /* Win9x: SWP_NOSENDCHANGING */
|
2004-05-10 19:59:20 +00:00
|
|
|
{ WM_ACTIVATEAPP, sent|wparam, 1 },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 1 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETTEXT, sent|defwinproc|optional },
|
2004-05-10 19:59:20 +00:00
|
|
|
{ WM_ACTIVATE, sent|wparam, 1 },
|
|
|
|
{ HCBT_SETFOCUS, hook },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
|
2004-05-10 19:59:20 +00:00
|
|
|
{ WM_SETFOCUS, sent|wparam|defwinproc, 0 },
|
|
|
|
{ WM_NCPAINT, sent|wparam|optional, 1 },
|
|
|
|
{ WM_GETTEXT, sent|defwinproc|optional },
|
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_NCCALCSIZE, sent|wparam|optional, 1 },
|
|
|
|
{ WM_NCPAINT, sent|wparam|optional, 1 },
|
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
2004-05-10 19:59:20 +00:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* SetWindowPos(SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE)
|
|
|
|
* for a visible overlapped window.
|
|
|
|
*/
|
|
|
|
static const struct message WmSWP_HideOverlappedSeq[] = {
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* ShowWindow(SW_SHOW) for a not visible overlapped window */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmShowOverlappedSeq[] = {
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 1 },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_NCPAINT, sent|wparam|optional, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCPAINT, sent|wparam|optional, 1 },
|
|
|
|
{ WM_GETTEXT, sent|defwinproc|optional },
|
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
2004-03-26 00:18:20 +00:00
|
|
|
{ HCBT_ACTIVATE, hook },
|
2004-04-12 23:13:14 +00:00
|
|
|
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_ACTIVATEAPP, sent|wparam, 1 },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 1 },
|
2004-05-05 22:01:49 +00:00
|
|
|
{ WM_GETTEXT, sent|defwinproc|optional },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_ACTIVATE, sent|wparam, 1 },
|
2004-03-26 00:18:20 +00:00
|
|
|
{ HCBT_SETFOCUS, hook },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_SETFOCUS, sent|wparam|defwinproc, 0 },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_NCPAINT, sent|wparam|optional, 1 },
|
|
|
|
{ WM_GETTEXT, sent|defwinproc|optional },
|
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
2004-05-05 22:01:49 +00:00
|
|
|
{ WM_NCCALCSIZE, sent|optional },
|
|
|
|
{ WM_NCPAINT, sent|optional },
|
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
2004-05-10 19:59:20 +00:00
|
|
|
#if 0 /* CreateWindow/ShowWindow(SW_SHOW) also generates WM_SIZE/WM_MOVE
|
|
|
|
* messages. Does that mean that CreateWindow doesn't set initial
|
|
|
|
* window dimensions for overlapped windows?
|
|
|
|
*/
|
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
|
|
|
#endif
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* ShowWindow(SW_HIDE) for a visible overlapped window */
|
|
|
|
static const struct message WmHideOverlappedSeq[] = {
|
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
2004-05-10 19:59:20 +00:00
|
|
|
{ WM_NCACTIVATE, sent|wparam, 0 },
|
|
|
|
{ WM_ACTIVATE, sent|wparam, 0 },
|
|
|
|
{ WM_ACTIVATEAPP, sent|wparam, 0 },
|
|
|
|
{ WM_KILLFOCUS, sent|wparam, 0 },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ 0 }
|
|
|
|
};
|
2004-05-10 19:59:20 +00:00
|
|
|
/* DestroyWindow for a visible overlapped window */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmDestroyOverlappedSeq[] = {
|
2004-03-26 00:18:20 +00:00
|
|
|
{ HCBT_DESTROYWND, hook },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 0 },
|
|
|
|
{ WM_ACTIVATE, sent|wparam, 0 },
|
|
|
|
{ WM_ACTIVATEAPP, sent|wparam, 0 },
|
|
|
|
{ WM_KILLFOCUS, sent|wparam, 0 },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_DESTROY, sent },
|
|
|
|
{ WM_NCDESTROY, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
2004-04-02 20:22:53 +00:00
|
|
|
/* CreateWindow (for a child popup window, not initially visible) */
|
|
|
|
static const struct message WmCreateChildPopupSeq[] = {
|
|
|
|
{ HCBT_CREATEWND, hook },
|
|
|
|
{ WM_NCCREATE, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 0 },
|
|
|
|
{ WM_CREATE, sent },
|
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* CreateWindow (for a popup window, not initially visible,
|
|
|
|
* which sets WS_VISIBLE in WM_CREATE handler)
|
|
|
|
*/
|
|
|
|
static const struct message WmCreateInvisiblePopupSeq[] = {
|
|
|
|
{ HCBT_CREATEWND, hook },
|
|
|
|
{ WM_NCCREATE, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 0 },
|
|
|
|
{ WM_CREATE, sent },
|
|
|
|
{ WM_STYLECHANGING, sent },
|
|
|
|
{ WM_STYLECHANGED, sent },
|
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* ShowWindow (for a popup window with WS_VISIBLE style set) */
|
|
|
|
static const struct message WmShowVisiblePopupSeq[] = {
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER)
|
|
|
|
* for a popup window with WS_VISIBLE style set
|
|
|
|
*/
|
|
|
|
static const struct message WmShowVisiblePopupSeq_2[] = {
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
|
|
|
|
* for a popup window with WS_VISIBLE style set
|
|
|
|
*/
|
|
|
|
static const struct message WmShowVisiblePopupSeq_3[] = {
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ HCBT_ACTIVATE, hook },
|
2004-04-12 23:13:14 +00:00
|
|
|
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
|
2004-04-02 20:22:53 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 1 },
|
|
|
|
{ WM_ACTIVATE, sent|wparam, 1 },
|
|
|
|
{ HCBT_SETFOCUS, hook },
|
2004-04-20 04:02:50 +00:00
|
|
|
{ WM_KILLFOCUS, sent|parent },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
|
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
|
2004-04-02 20:22:53 +00:00
|
|
|
{ WM_SETFOCUS, sent|defwinproc },
|
|
|
|
{ 0 }
|
|
|
|
};
|
2003-10-02 04:32:56 +00:00
|
|
|
/* CreateWindow (for child window, not initially visible) */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmCreateChildSeq[] = {
|
2004-03-26 00:18:20 +00:00
|
|
|
{ HCBT_CREATEWND, hook },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_NCCREATE, sent },
|
|
|
|
/* child is inserted into parent's child list after WM_NCCREATE returns */
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 0 },
|
|
|
|
{ WM_CREATE, sent },
|
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
2004-04-30 04:15:13 +00:00
|
|
|
{ WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ 0 }
|
|
|
|
};
|
2004-04-29 20:00:40 +00:00
|
|
|
/* CreateWindow (for maximized child window, not initially visible) */
|
|
|
|
static const struct message WmCreateMaximizedChildSeq[] = {
|
|
|
|
{ HCBT_CREATEWND, hook },
|
|
|
|
{ WM_NCCREATE, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 0 },
|
|
|
|
{ WM_CREATE, sent },
|
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
|
|
|
{ HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
|
|
|
|
{ WM_GETMINMAXINFO, sent },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent },
|
|
|
|
{ WM_SIZE, sent|defwinproc },
|
2004-04-30 04:15:13 +00:00
|
|
|
{ WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
|
2004-04-29 20:00:40 +00:00
|
|
|
{ 0 }
|
|
|
|
};
|
2004-05-10 19:59:20 +00:00
|
|
|
/* ShowWindow(SW_SHOW) for a not visible child window */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmShowChildSeq[] = {
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_ERASEBKGND, sent|parent|optional },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
2004-05-10 19:59:20 +00:00
|
|
|
/* DestroyWindow for a visible child window */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmDestroyChildSeq[] = {
|
2004-03-26 00:18:20 +00:00
|
|
|
{ HCBT_DESTROYWND, hook },
|
2004-04-30 04:15:13 +00:00
|
|
|
{ WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_ERASEBKGND, sent|parent|optional },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
2004-03-26 01:06:15 +00:00
|
|
|
{ HCBT_SETFOCUS, hook }, /* set focus to a parent */
|
|
|
|
{ WM_KILLFOCUS, sent },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
|
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|parent|optional, 1 },
|
|
|
|
{ WM_SETFOCUS, sent|parent },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_DESTROY, sent },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_DESTROY, sent|optional }, /* a bug in win2k sp4 ? */
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_NCDESTROY, sent },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_NCDESTROY, sent|optional }, /* a bug in win2k sp4 ? */
|
2003-10-02 04:32:56 +00:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Moving the mouse in nonclient area */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_NCHITTEST, sent },
|
|
|
|
{ WM_SETCURSOR, sent },
|
|
|
|
{ WM_NCMOUSEMOVE, posted },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Moving the mouse in client area */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmMouseMoveInClientAreaSeq[] = { /* FIXME: add */
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_NCHITTEST, sent },
|
|
|
|
{ WM_SETCURSOR, sent },
|
|
|
|
{ WM_MOUSEMOVE, posted },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmDragTitleBarSeq[] = { /* FIXME: add */
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_NCLBUTTONDOWN, sent|wparam, HTCAPTION },
|
|
|
|
{ WM_SYSCOMMAND, sent|defwinproc|wparam, SC_MOVE+2 },
|
|
|
|
{ WM_GETMINMAXINFO, sent|defwinproc },
|
|
|
|
{ WM_ENTERSIZEMOVE, sent|defwinproc },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|defwinproc },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|defwinproc },
|
|
|
|
{ WM_MOVE, sent|defwinproc },
|
|
|
|
{ WM_EXITSIZEMOVE, sent|defwinproc },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
|
2004-03-26 01:06:15 +00:00
|
|
|
static const struct message WmDragThickBordersBarSeq[] = { /* FIXME: add */
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_NCLBUTTONDOWN, sent|wparam, 0xd },
|
|
|
|
{ WM_SYSCOMMAND, sent|defwinproc|wparam, 0xf004 },
|
|
|
|
{ WM_GETMINMAXINFO, sent|defwinproc },
|
|
|
|
{ WM_ENTERSIZEMOVE, sent|defwinproc },
|
|
|
|
{ WM_SIZING, sent|defwinproc|wparam, 4}, /* one for each mouse movement */
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|defwinproc },
|
|
|
|
{ WM_GETMINMAXINFO, sent|defwinproc },
|
|
|
|
{ WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
|
|
|
|
{ WM_NCPAINT, sent|defwinproc|wparam, 1 },
|
|
|
|
{ WM_GETTEXT, sent|defwinproc },
|
|
|
|
{ WM_ERASEBKGND, sent|defwinproc },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|defwinproc },
|
|
|
|
{ WM_MOVE, sent|defwinproc },
|
|
|
|
{ WM_SIZE, sent|defwinproc },
|
|
|
|
{ WM_EXITSIZEMOVE, sent|defwinproc },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Resizing child window with MoveWindow (32) */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmResizingChildWithMoveWindowSeq[] = {
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 1 },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_WINDOWPOSCHANGED, sent },
|
|
|
|
{ WM_MOVE, sent|defwinproc },
|
|
|
|
{ WM_SIZE, sent|defwinproc },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Clicking on inactive button */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmClickInactiveButtonSeq[] = { /* FIXME: add */
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_NCHITTEST, sent },
|
|
|
|
{ WM_PARENTNOTIFY, sent|parent|wparam, WM_LBUTTONDOWN },
|
|
|
|
{ WM_MOUSEACTIVATE, sent },
|
|
|
|
{ WM_MOUSEACTIVATE, sent|parent|defwinproc },
|
|
|
|
{ WM_SETCURSOR, sent },
|
|
|
|
{ WM_SETCURSOR, sent|parent|defwinproc },
|
|
|
|
{ WM_LBUTTONDOWN, posted },
|
|
|
|
{ WM_KILLFOCUS, posted|parent },
|
|
|
|
{ WM_SETFOCUS, posted },
|
|
|
|
{ WM_CTLCOLORBTN, posted|parent },
|
|
|
|
{ BM_SETSTATE, posted },
|
|
|
|
{ WM_CTLCOLORBTN, posted|parent },
|
|
|
|
{ WM_LBUTTONUP, posted },
|
|
|
|
{ BM_SETSTATE, posted },
|
|
|
|
{ WM_CTLCOLORBTN, posted|parent },
|
|
|
|
{ WM_COMMAND, posted|parent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Reparenting a button (16/32) */
|
|
|
|
/* The last child (button) reparented gets topmost for its new parent. */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmReparentButtonSeq[] = { /* FIXME: add */
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER },
|
|
|
|
{ WM_ERASEBKGND, sent|parent },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOZORDER },
|
|
|
|
{ WM_CHILDACTIVATE, sent },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOREDRAW|SWP_NOZORDER },
|
|
|
|
{ WM_MOVE, sent|defwinproc },
|
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 1 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
2004-04-20 04:02:50 +00:00
|
|
|
/* Creation of a custom dialog (32) */
|
|
|
|
static const struct message WmCreateCustomDialogSeq[] = {
|
|
|
|
{ HCBT_CREATEWND, hook },
|
|
|
|
{ WM_GETMINMAXINFO, sent },
|
|
|
|
{ WM_NCCREATE, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 0 },
|
|
|
|
{ WM_CREATE, sent },
|
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 1 },
|
|
|
|
{ HCBT_ACTIVATE, hook },
|
|
|
|
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 1 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETTEXT, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETTEXT, sent|optional|defwinproc },
|
2004-04-20 04:02:50 +00:00
|
|
|
{ WM_ACTIVATE, sent|wparam, 1 },
|
|
|
|
{ WM_KILLFOCUS, sent|parent },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
|
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
|
2004-04-20 04:02:50 +00:00
|
|
|
{ WM_SETFOCUS, sent },
|
|
|
|
{ WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCPAINT, sent|wparam, 1 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETTEXT, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETTEXT, sent|optional|defwinproc },
|
2004-04-20 04:02:50 +00:00
|
|
|
{ WM_ERASEBKGND, sent },
|
|
|
|
{ WM_CTLCOLORDLG, sent|defwinproc },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETTEXT, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
|
|
|
{ WM_NCCALCSIZE, sent|optional },
|
|
|
|
{ WM_NCPAINT, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETTEXT, sent|optional|defwinproc },
|
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
|
|
|
{ WM_CTLCOLORDLG, sent|optional|defwinproc },
|
2004-04-20 04:02:50 +00:00
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
2004-05-18 20:44:23 +00:00
|
|
|
/* Calling EndDialog for a custom dialog (32) */
|
|
|
|
static const struct message WmEndCustomDialogSeq[] = {
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ HCBT_ACTIVATE, hook },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 0 },
|
|
|
|
{ WM_GETTEXT, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETICON, sent|optional|defwinproc },
|
|
|
|
{ WM_GETTEXT, sent|optional|defwinproc },
|
|
|
|
{ WM_ACTIVATE, sent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|optional },
|
|
|
|
{ HCBT_SETFOCUS, hook },
|
|
|
|
{ WM_KILLFOCUS, sent },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
|
|
|
|
{ WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 },
|
|
|
|
{ WM_SETFOCUS, sent|parent|defwinproc },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Creation and destruction of a modal dialog (32) */
|
|
|
|
static const struct message WmModalDialogSeq[] = {
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_CANCELMODE, sent|parent },
|
|
|
|
{ WM_KILLFOCUS, sent|parent },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_ENABLE, sent|parent|wparam, 0 },
|
|
|
|
{ WM_SETFONT, sent },
|
|
|
|
{ WM_INITDIALOG, sent },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_CHANGEUISTATE, sent|optional },
|
|
|
|
{ WM_SHOWWINDOW, sent },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 1 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_ACTIVATE, sent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_NCPAINT, sent },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_ERASEBKGND, sent },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_CTLCOLORDLG, sent },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_WINDOWPOSCHANGED, sent },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_NCCALCSIZE, sent|optional },
|
|
|
|
{ WM_NCPAINT, sent|optional },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
|
|
|
{ WM_CTLCOLORDLG, sent|optional },
|
|
|
|
{ WM_PAINT, sent|optional },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_CTLCOLORBTN, sent },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_ENTERIDLE, sent|parent },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_TIMER, sent },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_ENABLE, sent|parent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
|
|
|
{ HCBT_ACTIVATE, hook },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_NCACTIVATE, sent|wparam, 0 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_ACTIVATE, sent|wparam, 0 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|optional },
|
|
|
|
{ HCBT_SETFOCUS, hook },
|
2004-05-20 01:17:28 +00:00
|
|
|
{ WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 },
|
|
|
|
{ WM_SETFOCUS, sent|parent|defwinproc },
|
2003-10-02 04:32:56 +00:00
|
|
|
{ WM_DESTROY, sent },
|
|
|
|
{ WM_NCDESTROY, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* Creation of a modal dialog that is resized inside WM_INITDIALOG (32) */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmCreateModalDialogResizeSeq[] = { /* FIXME: add */
|
2003-10-02 04:32:56 +00:00
|
|
|
/* (inside dialog proc, handling WM_INITDIALOG) */
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent },
|
|
|
|
{ WM_NCACTIVATE, sent|parent|wparam, 0 },
|
|
|
|
{ WM_GETTEXT, sent|defwinproc },
|
|
|
|
{ WM_ACTIVATE, sent|parent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|parent },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 1 },
|
|
|
|
{ WM_ACTIVATE, sent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent },
|
|
|
|
{ WM_SIZE, sent|defwinproc },
|
|
|
|
/* (setting focus) */
|
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent },
|
|
|
|
{ WM_NCPAINT, sent },
|
|
|
|
{ WM_GETTEXT, sent|defwinproc },
|
|
|
|
{ WM_ERASEBKGND, sent },
|
|
|
|
{ WM_CTLCOLORDLG, sent|defwinproc },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent },
|
|
|
|
{ WM_PAINT, sent },
|
|
|
|
/* (bunch of WM_CTLCOLOR* for each control) */
|
|
|
|
{ WM_PAINT, sent|parent },
|
|
|
|
{ WM_ENTERIDLE, sent|parent|wparam, 0 },
|
|
|
|
{ WM_SETCURSOR, sent|parent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
2004-02-17 20:29:05 +00:00
|
|
|
/* SetMenu for NonVisible windows with size change*/
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmSetMenuNonVisibleSizeChangeSeq[] = {
|
2004-02-17 20:29:05 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
2004-04-06 20:09:59 +00:00
|
|
|
{ WM_MOVE, sent|defwinproc },
|
|
|
|
{ WM_SIZE, sent|defwinproc },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETICON, sent|optional },
|
|
|
|
{ WM_GETTEXT, sent|optional },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam|optional, 1 },
|
2004-02-17 20:29:05 +00:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* SetMenu for NonVisible windows with no size change */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmSetMenuNonVisibleNoSizeChangeSeq[] = {
|
2004-02-17 20:29:05 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* SetMenu for Visible windows with size change */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmSetMenuVisibleSizeChangeSeq[] = {
|
2004-02-17 20:29:05 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 1 },
|
|
|
|
{ WM_NCPAINT, sent|wparam, 1 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETTEXT, sent|defwinproc|optional },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
|
|
|
{ WM_ACTIVATE, sent|optional },
|
2004-02-17 20:29:05 +00:00
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
2004-04-06 20:09:59 +00:00
|
|
|
{ WM_MOVE, sent|defwinproc },
|
|
|
|
{ WM_SIZE, sent|defwinproc },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_NCCALCSIZE, sent|wparam|optional, 1 },
|
|
|
|
{ WM_NCPAINT, sent|wparam|optional, 1 },
|
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
2004-02-17 20:29:05 +00:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
/* SetMenu for Visible windows with no size change */
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message WmSetMenuVisibleNoSizeChangeSeq[] = {
|
2004-02-17 20:29:05 +00:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 1 },
|
|
|
|
{ WM_NCPAINT, sent|wparam, 1 },
|
2004-05-18 20:44:23 +00:00
|
|
|
{ WM_GETTEXT, sent|defwinproc|optional },
|
2004-03-25 23:35:52 +00:00
|
|
|
{ WM_ERASEBKGND, sent|optional },
|
|
|
|
{ WM_ACTIVATE, sent|optional },
|
2004-02-17 20:29:05 +00:00
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
2003-10-02 04:32:56 +00:00
|
|
|
|
2004-04-08 19:07:06 +00:00
|
|
|
static const struct message WmSetRedrawFalseSeq[] =
|
|
|
|
{
|
|
|
|
{ WM_SETREDRAW, sent|wparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message WmSetRedrawTrueSeq[] =
|
|
|
|
{
|
|
|
|
{ WM_SETREDRAW, sent|wparam, 1 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2004-05-18 20:44:23 +00:00
|
|
|
static int after_end_dialog;
|
2003-10-02 04:32:56 +00:00
|
|
|
static int sequence_cnt, sequence_size;
|
|
|
|
static struct message* sequence;
|
|
|
|
|
2004-03-25 23:35:52 +00:00
|
|
|
static void add_message(const struct message *msg)
|
2003-10-02 04:32:56 +00:00
|
|
|
{
|
|
|
|
if (!sequence)
|
2004-03-25 23:35:52 +00:00
|
|
|
{
|
|
|
|
sequence_size = 10;
|
2004-03-27 20:41:43 +00:00
|
|
|
sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof (struct message) );
|
2004-03-25 23:35:52 +00:00
|
|
|
}
|
2003-10-02 04:32:56 +00:00
|
|
|
if (sequence_cnt == sequence_size)
|
2004-03-25 23:35:52 +00:00
|
|
|
{
|
|
|
|
sequence_size *= 2;
|
2004-03-27 20:41:43 +00:00
|
|
|
sequence = HeapReAlloc( GetProcessHeap(), 0, sequence, sequence_size * sizeof (struct message) );
|
2004-03-25 23:35:52 +00:00
|
|
|
}
|
2003-10-02 04:32:56 +00:00
|
|
|
assert(sequence);
|
2004-03-25 23:35:52 +00:00
|
|
|
|
|
|
|
sequence[sequence_cnt].message = msg->message;
|
|
|
|
sequence[sequence_cnt].flags = msg->flags;
|
|
|
|
sequence[sequence_cnt].wParam = msg->wParam;
|
|
|
|
sequence[sequence_cnt].lParam = msg->lParam;
|
|
|
|
|
|
|
|
sequence_cnt++;
|
2003-10-02 04:32:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void flush_sequence()
|
|
|
|
{
|
2004-03-27 20:41:43 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, sequence);
|
2003-10-02 04:32:56 +00:00
|
|
|
sequence = 0;
|
|
|
|
sequence_cnt = sequence_size = 0;
|
|
|
|
}
|
|
|
|
|
2004-03-25 23:35:52 +00:00
|
|
|
static void ok_sequence(const struct message *expected, const char *context)
|
2003-10-02 04:32:56 +00:00
|
|
|
{
|
2004-03-25 23:35:52 +00:00
|
|
|
static const struct message end_of_sequence = { 0, 0, 0, 0 };
|
2004-03-27 20:41:43 +00:00
|
|
|
const struct message *actual;
|
2003-10-02 04:32:56 +00:00
|
|
|
|
2004-03-25 23:35:52 +00:00
|
|
|
add_message(&end_of_sequence);
|
2003-10-02 04:32:56 +00:00
|
|
|
|
2004-03-27 20:41:43 +00:00
|
|
|
actual = sequence;
|
|
|
|
|
2004-03-25 23:35:52 +00:00
|
|
|
while (expected->message && actual->message)
|
2003-10-02 04:32:56 +00:00
|
|
|
{
|
2004-03-25 23:35:52 +00:00
|
|
|
trace("expected %04x - actual %04x\n", expected->message, actual->message);
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
if (expected->message == actual->message)
|
|
|
|
{
|
|
|
|
if (expected->flags & wparam)
|
|
|
|
ok (expected->wParam == actual->wParam,
|
|
|
|
"%s: in msg 0x%04x expecting wParam 0x%x got 0x%x\n",
|
|
|
|
context, expected->message, expected->wParam, actual->wParam);
|
|
|
|
if (expected->flags & lparam)
|
|
|
|
ok (expected->lParam == actual->lParam,
|
|
|
|
"%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
|
|
|
|
context, expected->message, expected->lParam, actual->lParam);
|
2004-04-06 20:09:59 +00:00
|
|
|
ok ((expected->flags & defwinproc) == (actual->flags & defwinproc),
|
|
|
|
"%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
|
|
|
|
context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
|
2003-10-02 04:32:56 +00:00
|
|
|
ok ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
|
|
|
|
"%s: the msg 0x%04x should have been %s\n",
|
|
|
|
context, expected->message, (expected->flags & posted) ? "posted" : "sent");
|
|
|
|
ok ((expected->flags & parent) == (actual->flags & parent),
|
|
|
|
"%s: the msg 0x%04x was expected in %s\n",
|
|
|
|
context, expected->message, (expected->flags & parent) ? "parent" : "child");
|
2004-03-26 00:18:20 +00:00
|
|
|
ok ((expected->flags & hook) == (actual->flags & hook),
|
2004-03-27 20:41:43 +00:00
|
|
|
"%s: the msg 0x%04x should have been sent by a hook\n",
|
2004-03-26 00:18:20 +00:00
|
|
|
context, expected->message);
|
2003-10-02 04:32:56 +00:00
|
|
|
expected++;
|
|
|
|
actual++;
|
|
|
|
}
|
2004-03-25 23:35:52 +00:00
|
|
|
else if (expected->flags & optional)
|
2003-10-02 04:32:56 +00:00
|
|
|
expected++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
todo_wine {
|
|
|
|
ok (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
|
|
|
|
context, expected->message, actual->message);
|
|
|
|
expected++;
|
|
|
|
actual++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-10 19:59:20 +00:00
|
|
|
/* skip all optional trailing messages */
|
|
|
|
while (expected->message && (expected->flags & optional))
|
|
|
|
expected++;
|
|
|
|
|
2004-03-25 23:35:52 +00:00
|
|
|
todo_wine {
|
|
|
|
if (expected->message || actual->message)
|
2004-05-18 20:44:23 +00:00
|
|
|
ok (FALSE, "%s: the msg sequence is not complete (got 0x%04x)\n", context, actual->message);
|
2004-03-25 23:35:52 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
flush_sequence();
|
|
|
|
}
|
|
|
|
|
2004-04-08 19:07:06 +00:00
|
|
|
static void test_WM_SETREDRAW(HWND hwnd)
|
|
|
|
{
|
|
|
|
DWORD style = GetWindowLongA(hwnd, GWL_STYLE);
|
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
|
|
|
|
SendMessageA(hwnd, WM_SETREDRAW, FALSE, 0);
|
|
|
|
ok_sequence(WmSetRedrawFalseSeq, "SetRedraw:FALSE");
|
|
|
|
|
|
|
|
ok(!(GetWindowLongA(hwnd, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should NOT be set\n");
|
|
|
|
ok(!IsWindowVisible(hwnd), "IsWindowVisible() should return FALSE\n");
|
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
SendMessageA(hwnd, WM_SETREDRAW, TRUE, 0);
|
|
|
|
ok_sequence(WmSetRedrawTrueSeq, "SetRedraw:TRUE");
|
|
|
|
|
|
|
|
ok(GetWindowLongA(hwnd, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n");
|
2004-05-05 01:35:37 +00:00
|
|
|
ok(IsWindowVisible(hwnd), "IsWindowVisible() should return TRUE\n");
|
2004-04-08 19:07:06 +00:00
|
|
|
|
|
|
|
/* restore original WS_VISIBLE state */
|
|
|
|
SetWindowLongA(hwnd, GWL_STYLE, style);
|
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
}
|
|
|
|
|
2004-05-18 20:44:23 +00:00
|
|
|
static INT_PTR CALLBACK TestModalDlgProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
trace("dialog: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam);
|
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(&msg);
|
|
|
|
|
|
|
|
if (message == WM_INITDIALOG) SetTimer( hwnd, 1, 100, NULL );
|
|
|
|
if (message == WM_TIMER) EndDialog( hwnd, 0 );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
/* test if we receive the right sequence of messages */
|
|
|
|
static void test_messages(void)
|
|
|
|
{
|
|
|
|
HWND hwnd, hparent, hchild;
|
|
|
|
HWND hchild2, hbutton;
|
2004-02-17 20:29:05 +00:00
|
|
|
HMENU hmenu;
|
2003-10-02 04:32:56 +00:00
|
|
|
|
|
|
|
hwnd = CreateWindowExA(0, "TestWindowClass", "Test overlapped", WS_OVERLAPPEDWINDOW,
|
|
|
|
100, 100, 200, 200, 0, 0, 0, NULL);
|
|
|
|
ok (hwnd != 0, "Failed to create overlapped window\n");
|
|
|
|
ok_sequence(WmCreateOverlappedSeq, "CreateWindow:overlapped");
|
2004-04-08 19:07:06 +00:00
|
|
|
|
|
|
|
/* test WM_SETREDRAW on a not visible top level window */
|
|
|
|
test_WM_SETREDRAW(hwnd);
|
2004-05-10 19:59:20 +00:00
|
|
|
|
|
|
|
SetWindowPos(hwnd, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
|
|
|
|
ok_sequence(WmSWP_ShowOverlappedSeq, "SetWindowPos:SWP_SHOWWINDOW:overlapped");
|
|
|
|
ok(IsWindowVisible(hwnd), "window should be visible at this point\n");
|
|
|
|
|
|
|
|
ok(GetActiveWindow() == hwnd, "window should be active\n");
|
|
|
|
ok(GetFocus() == hwnd, "window should have input focus\n");
|
|
|
|
ShowWindow(hwnd, SW_HIDE);
|
|
|
|
ok_sequence(WmHideOverlappedSeq, "ShowWindow(SW_HIDE):overlapped");
|
2003-10-02 04:32:56 +00:00
|
|
|
|
2004-04-02 20:22:53 +00:00
|
|
|
ShowWindow(hwnd, SW_SHOW);
|
2004-05-10 19:59:20 +00:00
|
|
|
ok_sequence(WmShowOverlappedSeq, "ShowWindow(SW_SHOW):overlapped");
|
|
|
|
|
|
|
|
ok(GetActiveWindow() == hwnd, "window should be active\n");
|
|
|
|
ok(GetFocus() == hwnd, "window should have input focus\n");
|
|
|
|
SetWindowPos(hwnd, 0,0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE);
|
|
|
|
ok_sequence(WmSWP_HideOverlappedSeq, "SetWindowPos:SWP_HIDEWINDOW:overlapped");
|
|
|
|
ok(!IsWindowVisible(hwnd), "window should not be visible at this point\n");
|
2003-10-02 04:32:56 +00:00
|
|
|
|
2004-04-08 19:07:06 +00:00
|
|
|
/* test WM_SETREDRAW on a visible top level window */
|
2004-05-10 19:59:20 +00:00
|
|
|
ShowWindow(hwnd, SW_SHOW);
|
2004-04-08 19:07:06 +00:00
|
|
|
test_WM_SETREDRAW(hwnd);
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
DestroyWindow(hwnd);
|
|
|
|
ok_sequence(WmDestroyOverlappedSeq, "DestroyWindow:overlapped");
|
|
|
|
|
2004-03-25 23:35:52 +00:00
|
|
|
hparent = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
2003-10-02 04:32:56 +00:00
|
|
|
100, 100, 200, 200, 0, 0, 0, NULL);
|
|
|
|
ok (hparent != 0, "Failed to create parent window\n");
|
|
|
|
flush_sequence();
|
|
|
|
|
2004-04-29 20:00:40 +00:00
|
|
|
hchild = CreateWindowExA(0, "TestWindowClass", "Test child", WS_CHILD | WS_MAXIMIZE,
|
|
|
|
0, 0, 10, 10, hparent, 0, 0, NULL);
|
|
|
|
ok (hchild != 0, "Failed to create child window\n");
|
|
|
|
ok_sequence(WmCreateMaximizedChildSeq, "CreateWindow:maximized child");
|
|
|
|
DestroyWindow(hchild);
|
|
|
|
flush_sequence();
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
hchild = CreateWindowExA(0, "TestWindowClass", "Test child", WS_CHILDWINDOW,
|
|
|
|
0, 0, 10, 10, hparent, 0, 0, NULL);
|
|
|
|
ok (hchild != 0, "Failed to create child window\n");
|
|
|
|
ok_sequence(WmCreateChildSeq, "CreateWindow:child");
|
|
|
|
|
|
|
|
hchild2 = CreateWindowExA(0, "SimpleWindowClass", "Test child2", WS_CHILDWINDOW,
|
|
|
|
100, 100, 50, 50, hparent, 0, 0, NULL);
|
|
|
|
ok (hchild2 != 0, "Failed to create child2 window\n");
|
|
|
|
flush_sequence();
|
|
|
|
|
|
|
|
hbutton = CreateWindowExA(0, "TestWindowClass", "Test button", WS_CHILDWINDOW,
|
|
|
|
0, 100, 50, 50, hchild, 0, 0, NULL);
|
|
|
|
ok (hbutton != 0, "Failed to create button window\n");
|
2004-04-08 19:07:06 +00:00
|
|
|
|
|
|
|
/* test WM_SETREDRAW on a not visible child window */
|
|
|
|
test_WM_SETREDRAW(hchild);
|
2003-10-02 04:32:56 +00:00
|
|
|
|
2004-04-02 20:22:53 +00:00
|
|
|
ShowWindow(hchild, SW_SHOW);
|
2003-10-02 04:32:56 +00:00
|
|
|
ok_sequence(WmShowChildSeq, "ShowWindow:child");
|
|
|
|
|
2004-04-08 19:07:06 +00:00
|
|
|
/* test WM_SETREDRAW on a visible child window */
|
|
|
|
test_WM_SETREDRAW(hchild);
|
|
|
|
|
2004-03-26 01:06:15 +00:00
|
|
|
SetFocus(hchild);
|
|
|
|
flush_sequence();
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
MoveWindow(hchild, 10, 10, 20, 20, TRUE);
|
|
|
|
ok_sequence(WmResizingChildWithMoveWindowSeq, "MoveWindow:child");
|
|
|
|
|
|
|
|
DestroyWindow(hchild);
|
|
|
|
ok_sequence(WmDestroyChildSeq, "DestroyWindow:child");
|
2004-02-17 20:29:05 +00:00
|
|
|
DestroyWindow(hchild2);
|
|
|
|
DestroyWindow(hbutton);
|
2004-04-02 20:22:53 +00:00
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
hchild = CreateWindowExA(0, "TestWindowClass", "Test Child Popup", WS_CHILD | WS_POPUP,
|
|
|
|
0, 0, 100, 100, hparent, 0, 0, NULL);
|
|
|
|
ok (hchild != 0, "Failed to create child popup window\n");
|
|
|
|
ok_sequence(WmCreateChildPopupSeq, "CreateWindow:child_popup");
|
|
|
|
DestroyWindow(hchild);
|
|
|
|
|
|
|
|
/* test what happens to a window which sets WS_VISIBLE in WM_CREATE */
|
|
|
|
flush_sequence();
|
|
|
|
hchild = CreateWindowExA(0, "TestPopupClass", "Test Popup", WS_POPUP,
|
|
|
|
0, 0, 100, 100, hparent, 0, 0, NULL);
|
|
|
|
ok (hchild != 0, "Failed to create popup window\n");
|
|
|
|
ok_sequence(WmCreateInvisiblePopupSeq, "CreateWindow:invisible_popup");
|
|
|
|
ok(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n");
|
|
|
|
ok(IsWindowVisible(hchild), "IsWindowVisible() should return TRUE\n");
|
|
|
|
flush_sequence();
|
|
|
|
ShowWindow(hchild, SW_SHOW);
|
|
|
|
ok_sequence(WmShowVisiblePopupSeq, "CreateWindow:show_visible_popup");
|
|
|
|
flush_sequence();
|
|
|
|
SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
|
|
|
|
ok_sequence(WmShowVisiblePopupSeq_2, "CreateWindow:show_visible_popup_2");
|
|
|
|
flush_sequence();
|
|
|
|
SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
|
|
|
|
ok_sequence(WmShowVisiblePopupSeq_3, "CreateWindow:show_visible_popup_3");
|
|
|
|
DestroyWindow(hchild);
|
|
|
|
|
|
|
|
/* this time add WS_VISIBLE for CreateWindowEx, but this fact actually
|
|
|
|
* changes nothing in message sequences.
|
|
|
|
*/
|
|
|
|
flush_sequence();
|
|
|
|
hchild = CreateWindowExA(0, "TestPopupClass", "Test Popup", WS_POPUP | WS_VISIBLE,
|
|
|
|
0, 0, 100, 100, hparent, 0, 0, NULL);
|
|
|
|
ok (hchild != 0, "Failed to create popup window\n");
|
|
|
|
ok_sequence(WmCreateInvisiblePopupSeq, "CreateWindow:invisible_popup");
|
|
|
|
ok(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n");
|
|
|
|
ok(IsWindowVisible(hchild), "IsWindowVisible() should return TRUE\n");
|
|
|
|
flush_sequence();
|
|
|
|
ShowWindow(hchild, SW_SHOW);
|
|
|
|
ok_sequence(WmShowVisiblePopupSeq, "CreateWindow:show_visible_popup");
|
|
|
|
flush_sequence();
|
|
|
|
SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
|
|
|
|
ok_sequence(WmShowVisiblePopupSeq_2, "CreateWindow:show_visible_popup_2");
|
|
|
|
DestroyWindow(hchild);
|
|
|
|
|
2004-04-20 04:02:50 +00:00
|
|
|
flush_sequence();
|
|
|
|
hwnd = CreateWindowExA(WS_EX_DLGMODALFRAME, "TestDialogClass", NULL, WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_DLGFRAME,
|
|
|
|
0, 0, 100, 100, hparent, 0, 0, NULL);
|
|
|
|
ok(hwnd != 0, "Failed to create custom dialog window\n");
|
|
|
|
ok_sequence(WmCreateCustomDialogSeq, "CreateCustomDialog");
|
2004-05-18 20:44:23 +00:00
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
after_end_dialog = 1;
|
|
|
|
EndDialog( hwnd, 0 );
|
|
|
|
ok_sequence(WmEndCustomDialogSeq, "EndCustomDialog");
|
|
|
|
|
2004-04-20 04:02:50 +00:00
|
|
|
DestroyWindow(hwnd);
|
2004-05-18 20:44:23 +00:00
|
|
|
after_end_dialog = 0;
|
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
DialogBoxA( 0, "TEST_DIALOG", hparent, TestModalDlgProcA );
|
|
|
|
ok_sequence(WmModalDialogSeq, "ModalDialog");
|
2004-04-20 04:02:50 +00:00
|
|
|
|
2004-02-17 20:29:05 +00:00
|
|
|
DestroyWindow(hparent);
|
|
|
|
flush_sequence();
|
|
|
|
|
|
|
|
/* Message sequence for SetMenu */
|
|
|
|
hmenu = CreateMenu();
|
|
|
|
ok (hmenu != 0, "Failed to create menu\n");
|
|
|
|
ok (InsertMenuA(hmenu, -1, MF_BYPOSITION, 0x1000, "foo"), "InsertMenu failed\n");
|
|
|
|
hwnd = CreateWindowExA(0, "TestWindowClass", "Test overlapped", WS_OVERLAPPEDWINDOW,
|
|
|
|
100, 100, 200, 200, 0, hmenu, 0, NULL);
|
|
|
|
ok_sequence(WmCreateOverlappedSeq, "CreateWindow:overlapped");
|
2004-05-05 01:35:37 +00:00
|
|
|
ok (SetMenu(hwnd, 0), "SetMenu\n");
|
2004-04-20 04:02:50 +00:00
|
|
|
ok_sequence(WmSetMenuNonVisibleSizeChangeSeq, "SetMenu:NonVisibleSizeChange");
|
2004-05-05 01:35:37 +00:00
|
|
|
ok (SetMenu(hwnd, 0), "SetMenu\n");
|
2004-04-20 04:02:50 +00:00
|
|
|
ok_sequence(WmSetMenuNonVisibleNoSizeChangeSeq, "SetMenu:NonVisibleNoSizeChange");
|
2004-04-02 20:22:53 +00:00
|
|
|
ShowWindow(hwnd, SW_SHOW);
|
2004-02-17 20:29:05 +00:00
|
|
|
flush_sequence();
|
2004-05-05 01:35:37 +00:00
|
|
|
ok (SetMenu(hwnd, 0), "SetMenu\n");
|
2004-04-20 04:02:50 +00:00
|
|
|
ok_sequence(WmSetMenuVisibleNoSizeChangeSeq, "SetMenu:VisibleNoSizeChange");
|
2004-05-05 01:35:37 +00:00
|
|
|
ok (SetMenu(hwnd, hmenu), "SetMenu\n");
|
2004-04-20 04:02:50 +00:00
|
|
|
ok_sequence(WmSetMenuVisibleSizeChangeSeq, "SetMenu:VisibleSizeChange");
|
2004-02-17 20:29:05 +00:00
|
|
|
|
2004-04-20 04:02:50 +00:00
|
|
|
DestroyWindow(hwnd);
|
2003-10-02 04:32:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2004-04-06 20:09:59 +00:00
|
|
|
static long defwndproc_counter = 0;
|
|
|
|
LRESULT ret;
|
2004-03-25 23:35:52 +00:00
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
trace("%p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam);
|
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
2004-04-06 20:09:59 +00:00
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
2004-03-25 23:35:52 +00:00
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(&msg);
|
2003-10-02 04:32:56 +00:00
|
|
|
|
2004-04-29 20:00:40 +00:00
|
|
|
if (message == WM_GETMINMAXINFO && (GetWindowLongA(hwnd, GWL_STYLE) & WS_CHILD))
|
|
|
|
{
|
|
|
|
HWND parent = GetParent(hwnd);
|
|
|
|
RECT rc;
|
|
|
|
MINMAXINFO *minmax = (MINMAXINFO *)lParam;
|
|
|
|
|
|
|
|
GetClientRect(parent, &rc);
|
|
|
|
trace("parent %p client size = (%ld x %ld)\n", parent, rc.right, rc.bottom);
|
|
|
|
|
|
|
|
trace("ptReserved = (%ld,%ld)\n"
|
|
|
|
"ptMaxSize = (%ld,%ld)\n"
|
|
|
|
"ptMaxPosition = (%ld,%ld)\n"
|
|
|
|
"ptMinTrackSize = (%ld,%ld)\n"
|
|
|
|
"ptMaxTrackSize = (%ld,%ld)\n",
|
|
|
|
minmax->ptReserved.x, minmax->ptReserved.y,
|
|
|
|
minmax->ptMaxSize.x, minmax->ptMaxSize.y,
|
|
|
|
minmax->ptMaxPosition.x, minmax->ptMaxPosition.y,
|
|
|
|
minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y,
|
|
|
|
minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y);
|
|
|
|
|
|
|
|
ok(minmax->ptMaxSize.x == rc.right, "default width of maximized child %ld != %ld\n",
|
|
|
|
minmax->ptMaxSize.x, rc.right);
|
|
|
|
ok(minmax->ptMaxSize.y == rc.bottom, "default height of maximized child %ld != %ld\n",
|
|
|
|
minmax->ptMaxSize.y, rc.bottom);
|
|
|
|
}
|
|
|
|
|
2004-04-06 20:09:59 +00:00
|
|
|
defwndproc_counter++;
|
|
|
|
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
2003-10-02 04:32:56 +00:00
|
|
|
}
|
|
|
|
|
2004-04-02 20:22:53 +00:00
|
|
|
static LRESULT WINAPI PopupMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2004-04-06 20:09:59 +00:00
|
|
|
static long defwndproc_counter = 0;
|
|
|
|
LRESULT ret;
|
2004-04-02 20:22:53 +00:00
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
trace("popup: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam);
|
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
2004-04-06 20:09:59 +00:00
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
2004-04-02 20:22:53 +00:00
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(&msg);
|
|
|
|
|
|
|
|
if (message == WM_CREATE)
|
|
|
|
{
|
|
|
|
DWORD style = GetWindowLongA(hwnd, GWL_STYLE) | WS_VISIBLE;
|
|
|
|
SetWindowLongA(hwnd, GWL_STYLE, style);
|
|
|
|
}
|
|
|
|
|
2004-04-06 20:09:59 +00:00
|
|
|
defwndproc_counter++;
|
|
|
|
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
2004-04-02 20:22:53 +00:00
|
|
|
}
|
|
|
|
|
2004-03-26 02:28:28 +00:00
|
|
|
static LRESULT WINAPI ParentMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2004-04-06 20:09:59 +00:00
|
|
|
static long defwndproc_counter = 0;
|
|
|
|
LRESULT ret;
|
2004-03-26 02:28:28 +00:00
|
|
|
struct message msg;
|
|
|
|
|
2004-04-02 20:22:53 +00:00
|
|
|
trace("parent: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam);
|
2004-03-26 02:28:28 +00:00
|
|
|
|
2004-04-20 04:02:50 +00:00
|
|
|
if (message == WM_PARENTNOTIFY || message == WM_CANCELMODE ||
|
2004-05-20 01:17:28 +00:00
|
|
|
message == WM_SETFOCUS || message == WM_KILLFOCUS ||
|
|
|
|
message == WM_ENABLE || message == WM_ENTERIDLE ||
|
|
|
|
message == WM_IME_SETCONTEXT)
|
2004-03-26 02:28:28 +00:00
|
|
|
{
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|parent|wparam|lparam;
|
2004-04-06 20:09:59 +00:00
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
2004-03-26 02:28:28 +00:00
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(&msg);
|
|
|
|
}
|
|
|
|
|
2004-04-06 20:09:59 +00:00
|
|
|
defwndproc_counter++;
|
|
|
|
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
2004-03-26 02:28:28 +00:00
|
|
|
}
|
|
|
|
|
2004-04-20 04:02:50 +00:00
|
|
|
static LRESULT WINAPI TestDlgProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
static long defwndproc_counter = 0;
|
|
|
|
LRESULT ret;
|
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
trace("dialog: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam);
|
|
|
|
|
|
|
|
DefDlgProcA(hwnd, DM_SETDEFID, 1, 0);
|
|
|
|
ret = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
|
2004-05-18 20:44:23 +00:00
|
|
|
if (after_end_dialog)
|
|
|
|
ok( ret == 0, "DM_GETDEFID should return 0 after EndDialog, got %lx\n", ret );
|
|
|
|
else
|
|
|
|
ok(HIWORD(ret) == DC_HASDEFID, "DM_GETDEFID should return DC_HASDEFID, got %lx\n", ret);
|
2004-04-20 04:02:50 +00:00
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(&msg);
|
|
|
|
|
|
|
|
defwndproc_counter++;
|
|
|
|
ret = DefDlgProcA(hwnd, message, wParam, lParam);
|
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
static BOOL RegisterWindowClasses(void)
|
|
|
|
{
|
|
|
|
WNDCLASSA cls;
|
|
|
|
|
|
|
|
cls.style = 0;
|
|
|
|
cls.lpfnWndProc = MsgCheckProcA;
|
|
|
|
cls.cbClsExtra = 0;
|
|
|
|
cls.cbWndExtra = 0;
|
|
|
|
cls.hInstance = GetModuleHandleA(0);
|
|
|
|
cls.hIcon = 0;
|
|
|
|
cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
|
|
|
|
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
|
|
|
|
cls.lpszMenuName = NULL;
|
|
|
|
cls.lpszClassName = "TestWindowClass";
|
2004-04-02 20:22:53 +00:00
|
|
|
if(!RegisterClassA(&cls)) return FALSE;
|
2003-10-02 04:32:56 +00:00
|
|
|
|
2004-04-02 20:22:53 +00:00
|
|
|
cls.lpfnWndProc = PopupMsgCheckProcA;
|
|
|
|
cls.lpszClassName = "TestPopupClass";
|
2003-10-02 04:32:56 +00:00
|
|
|
if(!RegisterClassA(&cls)) return FALSE;
|
|
|
|
|
2004-03-26 02:28:28 +00:00
|
|
|
cls.lpfnWndProc = ParentMsgCheckProcA;
|
2003-10-02 04:32:56 +00:00
|
|
|
cls.lpszClassName = "TestParentClass";
|
|
|
|
if(!RegisterClassA(&cls)) return FALSE;
|
|
|
|
|
|
|
|
cls.lpfnWndProc = DefWindowProcA;
|
|
|
|
cls.lpszClassName = "SimpleWindowClass";
|
|
|
|
if(!RegisterClassA(&cls)) return FALSE;
|
|
|
|
|
2004-04-20 04:02:50 +00:00
|
|
|
ok(GetClassInfoA(0, "#32770", &cls), "GetClassInfo failed\n");
|
|
|
|
cls.lpfnWndProc = TestDlgProcA;
|
|
|
|
cls.lpszClassName = "TestDialogClass";
|
|
|
|
if(!RegisterClassA(&cls)) return FALSE;
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-26 00:18:20 +00:00
|
|
|
static HHOOK hCBT_hook;
|
|
|
|
|
|
|
|
static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
trace("CBT: %d, %08x, %08lx\n", nCode, wParam, lParam);
|
|
|
|
|
|
|
|
if (GetClassNameA((HWND)wParam, buf, sizeof(buf)))
|
|
|
|
{
|
|
|
|
if (!strcmp(buf, "TestWindowClass") ||
|
|
|
|
!strcmp(buf, "TestParentClass") ||
|
2004-04-02 20:22:53 +00:00
|
|
|
!strcmp(buf, "TestPopupClass") ||
|
2004-04-20 04:02:50 +00:00
|
|
|
!strcmp(buf, "SimpleWindowClass") ||
|
|
|
|
!strcmp(buf, "TestDialogClass"))
|
2004-03-26 00:18:20 +00:00
|
|
|
{
|
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
msg.message = nCode;
|
|
|
|
msg.flags = hook;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(&msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return CallNextHookEx(hCBT_hook, nCode, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
START_TEST(msg)
|
|
|
|
{
|
|
|
|
if (!RegisterWindowClasses()) assert(0);
|
|
|
|
|
2004-03-26 00:18:20 +00:00
|
|
|
hCBT_hook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
|
|
|
|
assert(hCBT_hook);
|
|
|
|
|
2003-10-02 04:32:56 +00:00
|
|
|
test_messages();
|
2004-03-26 00:18:20 +00:00
|
|
|
|
|
|
|
UnhookWindowsHookEx(hCBT_hook);
|
2003-10-02 04:32:56 +00:00
|
|
|
}
|