user32: Avoid sending unwanted DM_GETDEFID/DM_SETDEFID messages.

This commit is contained in:
Dmitry Timoshkov 2007-02-14 18:45:45 +08:00 committed by Alexandre Julliard
parent 157205c085
commit f407e9a05d
1 changed files with 17 additions and 68 deletions

View File

@ -877,95 +877,51 @@ static const struct message WmReparentButtonSeq[] = { /* FIXME: add */
/* Creation of a custom dialog (32) */
static const struct message WmCreateCustomDialogSeq[] = {
{ HCBT_CREATEWND, hook },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_GETMINMAXINFO, sent },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_NCCREATE, sent },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_NCCALCSIZE, sent|wparam, 0 },
{ EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_CREATE, sent },
{ EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_SHOWWINDOW, sent|wparam, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
{ EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
{ HCBT_ACTIVATE, hook },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOMOVE },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_NCACTIVATE, sent|wparam, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_GETTEXT, sent|optional|defwinproc },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_GETTEXT, sent|optional|defwinproc },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_ACTIVATE, sent|wparam, 1 },
{ WM_KILLFOCUS, sent|parent },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_SETFOCUS, sent },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_NCPAINT, sent|wparam, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_GETTEXT, sent|optional|defwinproc },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_GETTEXT, sent|optional|defwinproc },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_ERASEBKGND, sent },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_CTLCOLORDLG, sent|defwinproc },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_GETTEXT, sent|optional },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_GETTEXT, sent|optional },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_NCCALCSIZE, sent|optional },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_NCPAINT, sent|optional },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_GETTEXT, sent|optional|defwinproc },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_GETTEXT, sent|optional|defwinproc },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_ERASEBKGND, sent|optional },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_CTLCOLORDLG, sent|optional|defwinproc },
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_SIZE, sent|wparam, SIZE_RESTORED },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_MOVE, sent },
{ 0 }
};
@ -993,46 +949,29 @@ static const struct message WmEndCustomDialogSeq[] = {
};
/* ShowWindow(SW_SHOW) for a custom dialog (initially invisible) */
static const struct message WmShowCustomDialogSeq[] = {
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_SHOWWINDOW, sent|wparam, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
{ EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
{ HCBT_ACTIVATE, hook },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOMOVE },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_ACTIVATEAPP, sent|wparam|optional, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_NCACTIVATE, sent|wparam, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_ACTIVATE, sent|wparam, 1 },
{ WM_KILLFOCUS, sent|parent },
{ WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_SETFOCUS, sent },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_NCPAINT, sent|wparam, 1 },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_ERASEBKGND, sent },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_CTLCOLORDLG, sent|defwinproc },
{ EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
{ 0 }
};
@ -1051,6 +990,7 @@ static const struct message WmModalDialogSeq[] = {
{ WM_SETFONT, sent },
{ WM_INITDIALOG, sent },
{ WM_CHANGEUISTATE, sent|optional },
{ WM_UPDATEUISTATE, sent|optional },
{ WM_SHOWWINDOW, sent },
{ HCBT_ACTIVATE, hook },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
@ -1348,7 +1288,7 @@ static const struct message WmSHOWNATopInvisible[] = {
{ 0 }
};
static int after_end_dialog;
static int after_end_dialog, test_def_id;
static int sequence_cnt, sequence_size;
static struct message* sequence;
static int log_all_parent_messages;
@ -3897,6 +3837,11 @@ static void test_messages(void)
test_scroll_messages(hwnd);
*/
flush_sequence();
test_def_id = 1;
SendMessage(hwnd, WM_NULL, 0, 0);
flush_sequence();
after_end_dialog = 1;
EndDialog( hwnd, 0 );
@ -3904,6 +3849,7 @@ static void test_messages(void)
DestroyWindow(hwnd);
after_end_dialog = 0;
test_def_id = 0;
hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP,
0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL);
@ -6013,12 +5959,15 @@ static LRESULT WINAPI TestDlgProcA(HWND hwnd, UINT message, WPARAM wParam, LPARA
/* explicitly ignore WM_GETICON message */
if (message == WM_GETICON) return 0;
DefDlgProcA(hwnd, DM_SETDEFID, 1, 0);
ret = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
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);
if (test_def_id)
{
DefDlgProcA(hwnd, DM_SETDEFID, 1, 0);
ret = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
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);
}
switch (message)
{