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

Andrew Eikum aeikum at codeweavers.com
Thu Oct 10 12:06:21 CDT 2013


---
 dlls/user32/edit.c      |  2 +-
 dlls/user32/tests/msg.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 3634710..dbf1dcc 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -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);
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index aab3d12..a23dd7f 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -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);
-- 
1.8.4




More information about the wine-patches mailing list