Commit 3ff27f35 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

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

parent f4f50c9e
...@@ -3791,7 +3791,7 @@ static void EDIT_WM_SetFocus(EDITSTATE *es) ...@@ -3791,7 +3791,7 @@ static void EDIT_WM_SetFocus(EDITSTATE *es)
EDIT_InvalidateText(es, es->selection_start, es->selection_end); EDIT_InvalidateText(es, es->selection_start, es->selection_end);
/* single line edit updates itself */ /* single line edit updates itself */
if (!(es->style & ES_MULTILINE)) if (IsWindowVisible(es->hwndSelf) && !(es->style & ES_MULTILINE))
{ {
HDC hdc = GetDC(es->hwndSelf); HDC hdc = GetDC(es->hwndSelf);
EDIT_WM_Paint(es, hdc); EDIT_WM_Paint(es, hdc);
......
...@@ -9453,6 +9453,17 @@ static const struct message sl_edit_setfocus[] = ...@@ -9453,6 +9453,17 @@ static const struct message sl_edit_setfocus[] =
{ WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_EDIT, EN_SETFOCUS) }, { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_EDIT, EN_SETFOCUS) },
{ 0 } { 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[] = static const struct message ml_edit_setfocus[] =
{ {
{ HCBT_SETFOCUS, hook }, { HCBT_SETFOCUS, hook },
...@@ -9602,6 +9613,10 @@ static void test_edit_messages(void) ...@@ -9602,6 +9613,10 @@ static void test_edit_messages(void)
dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0); dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
ok(dlg_code == (DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTARROWS), "wrong dlg_code %08x\n", dlg_code); 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); ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd); UpdateWindow(hwnd);
SetFocus(0); SetFocus(0);
......
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