Make DestroyWindow() not mess with a window focus, this should be

taken care of by ShowWindow(SW_HIDE).
Add a test for DestroyWindow() on a focused child.
This commit is contained in:
Dmitry Timoshkov 2004-03-26 01:06:15 +00:00 committed by Alexandre Julliard
parent 6a203fb885
commit d5a1e761ee
2 changed files with 7 additions and 13 deletions

View File

@ -133,6 +133,9 @@ static const struct message WmDestroyChildSeq[] = {
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 }, { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_ERASEBKGND, sent|parent|optional }, { WM_ERASEBKGND, sent|parent|optional },
{ WM_WINDOWPOSCHANGED, sent|wparam, 0 }, { WM_WINDOWPOSCHANGED, sent|wparam, 0 },
{ HCBT_SETFOCUS, hook }, /* set focus to a parent */
{ WM_KILLFOCUS, sent },
{ WM_IME_SETCONTEXT, sent|optional },
{ WM_DESTROY, sent }, { WM_DESTROY, sent },
{ WM_DESTROY, sent|optional }, /* a bug in win2k sp4 ? */ { WM_DESTROY, sent|optional }, /* a bug in win2k sp4 ? */
{ WM_NCDESTROY, sent }, { WM_NCDESTROY, sent },
@ -166,7 +169,7 @@ static const struct message WmDragTitleBarSeq[] = { /* FIXME: add */
{ 0 } { 0 }
}; };
/* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */ /* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
static const struct message WmDragThinkBordersBarSeq[] = { /* FIXME: add */ static const struct message WmDragThickBordersBarSeq[] = { /* FIXME: add */
{ WM_NCLBUTTONDOWN, sent|wparam, 0xd }, { WM_NCLBUTTONDOWN, sent|wparam, 0xd },
{ WM_SYSCOMMAND, sent|defwinproc|wparam, 0xf004 }, { WM_SYSCOMMAND, sent|defwinproc|wparam, 0xf004 },
{ WM_GETMINMAXINFO, sent|defwinproc }, { WM_GETMINMAXINFO, sent|defwinproc },
@ -480,6 +483,9 @@ static void test_messages(void)
ShowWindow(hchild, TRUE); ShowWindow(hchild, TRUE);
ok_sequence(WmShowChildSeq, "ShowWindow:child"); ok_sequence(WmShowChildSeq, "ShowWindow:child");
SetFocus(hchild);
flush_sequence();
MoveWindow(hchild, 10, 10, 20, 20, TRUE); MoveWindow(hchild, 10, 10, 20, 20, TRUE);
ok_sequence(WmResizingChildWithMoveWindowSeq, "MoveWindow:child"); ok_sequence(WmResizingChildWithMoveWindowSeq, "MoveWindow:child");

View File

@ -1475,7 +1475,6 @@ static void WIN_SendDestroyMsg( HWND hwnd )
BOOL WINAPI DestroyWindow( HWND hwnd ) BOOL WINAPI DestroyWindow( HWND hwnd )
{ {
BOOL is_child; BOOL is_child;
HWND h;
if (!(hwnd = WIN_IsCurrentThread( hwnd )) || (hwnd == GetDesktopWindow())) if (!(hwnd = WIN_IsCurrentThread( hwnd )) || (hwnd == GetDesktopWindow()))
{ {
@ -1485,17 +1484,6 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
TRACE("(%p)\n", hwnd); TRACE("(%p)\n", hwnd);
/* Look whether the focus is within the tree of windows we will
* be destroying.
*/
h = GetFocus();
if (h == hwnd || IsChild( hwnd, h ))
{
HWND parent = GetAncestor( hwnd, GA_PARENT );
if (parent == GetDesktopWindow()) parent = 0;
SetFocus( parent );
}
if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD) if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
SendMessageW(GetAncestor(hwnd, GA_PARENT), WM_MDIREFRESHMENU, 0, 0); SendMessageW(GetAncestor(hwnd, GA_PARENT), WM_MDIREFRESHMENU, 0, 0);