Commit e32e1f05 authored by Ulrich Czekalla's avatar Ulrich Czekalla Committed by Alexandre Julliard

EnableWindow should not remove the focus of child windows.

parent 7590fe58
......@@ -599,6 +599,13 @@ static const struct message WmSetRedrawTrueSeq[] =
{ 0 }
};
static const struct message WmEnableWindowSeq[] =
{
{ WM_CANCELMODE, sent },
{ WM_ENABLE, sent },
{ 0 }
};
static int after_end_dialog;
static int sequence_cnt, sequence_size;
static struct message* sequence;
......@@ -910,6 +917,24 @@ static void test_messages(void)
ok_sequence(WmDrawMenuBarSeq, "DrawMenuBar");
DestroyWindow(hwnd);
flush_sequence();
/* Message sequence for EnableWindow */
hparent = CreateWindowExA(0, "TestWindowClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 200, 200, 0, 0, 0, NULL);
ok (hparent != 0, "Failed to create parent window\n");
hchild = CreateWindowExA(0, "TestWindowClass", "Test child", WS_CHILDWINDOW | WS_VISIBLE,
0, 0, 10, 10, hparent, 0, 0, NULL);
ok (hchild != 0, "Failed to create child window\n");
SetFocus(hchild);
flush_sequence();
EnableWindow(hparent, FALSE);
ok_sequence(WmEnableWindowSeq, "EnableWindow");
DestroyWindow(hparent);
flush_sequence();
}
static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
......
......@@ -1626,6 +1626,14 @@ static void test_SetFocus(HWND hwnd)
ShowWindow(child, SW_HIDE);
ok( GetFocus() == hwnd, "Focus should still be on parent %p, not %p\n", hwnd, GetFocus() );
ShowWindow(hwnd, SW_SHOW);
ShowWindow(child, SW_SHOW);
SetFocus(child);
ok( GetFocus() == child, "Focus should be on child %p\n", child );
EnableWindow(hwnd, FALSE);
ok( GetFocus() == child, "Focus should still be on child %p\n", child );
EnableWindow(hwnd, TRUE);
DestroyWindow( child );
}
......
......@@ -1752,14 +1752,13 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
}
else if (!enable && !retvalue)
{
HWND focus_wnd, capture_wnd;
HWND capture_wnd;
SendMessageA( hwnd, WM_CANCELMODE, 0, 0);
WIN_SetStyle( hwnd, style | WS_DISABLED );
focus_wnd = GetFocus();
if (hwnd == focus_wnd || IsChild(hwnd, focus_wnd))
if (hwnd == GetFocus())
SetFocus( 0 ); /* A disabled window can't have the focus */
capture_wnd = GetCapture();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment