user32: Don't try to paint during WM_SETFOCUS if the edit control is not visible.

This commit is contained in:
Andrew Eikum 2013-10-10 12:06:21 -05:00 committed by Alexandre Julliard
parent f4f50c9e4a
commit 3ff27f3544
2 changed files with 16 additions and 1 deletions

View File

@ -3791,7 +3791,7 @@ static void EDIT_WM_SetFocus(EDITSTATE *es)
EDIT_InvalidateText(es, es->selection_start, es->selection_end);
/* single line edit updates itself */
if (!(es->style & ES_MULTILINE))
if (IsWindowVisible(es->hwndSelf) && !(es->style & ES_MULTILINE))
{
HDC hdc = GetDC(es->hwndSelf);
EDIT_WM_Paint(es, hdc);

View File

@ -9453,6 +9453,17 @@ static const struct message sl_edit_setfocus[] =
{ WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_EDIT, EN_SETFOCUS) },
{ 0 }
};
static const struct message sl_edit_invisible[] =
{
{ HCBT_SETFOCUS, hook },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
{ WM_KILLFOCUS, sent|parent },
{ WM_SETFOCUS, sent },
{ WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_EDIT, EN_SETFOCUS) },
{ 0 }
};
static const struct message ml_edit_setfocus[] =
{
{ HCBT_SETFOCUS, hook },
@ -9602,6 +9613,10 @@ static void test_edit_messages(void)
dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
ok(dlg_code == (DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTARROWS), "wrong dlg_code %08x\n", dlg_code);
flush_sequence();
SetFocus(hwnd);
ok_sequence(sl_edit_invisible, "SetFocus(hwnd) on an invisible edit", FALSE);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
SetFocus(0);