[PATCH] comctl32: Dont set caret position if we dont have focus

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Dec 4 20:08:33 CST 2018


When SetFont is called on an Edit Control which doesn't have
focus, it causes the current control to draw the caret in
the incorrect location until a key is pressed.

EDIT_SetCaretPos (es=0x204439c0, pos=0, after_wrap=0)
0x7eace3be in EDIT_AdjustFormatRect (es=0x204439c0)
0x7eace465 in EDIT_SetRectNP (es=0x204439c0, rc=<optimized out>)
0x7ead180c in EDIT_WM_SetFont (es=0x204439c0, font=<optimized out>, redraw=1)

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/comctl32/edit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
index 06e1f498dc9..3ffc2e5c16a 100644
--- a/dlls/comctl32/edit.c
+++ b/dlls/comctl32/edit.c
@@ -2238,7 +2238,8 @@ static void EDIT_AdjustFormatRect(EDITSTATE *es)
 	if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
 		EDIT_BuildLineDefs_ML(es, 0, get_text_length(es), 0, NULL);
 
-	EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
+    if (es->flags & EF_FOCUSED)
+        EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
 }
 
 
-- 
2.19.2




More information about the wine-devel mailing list