Alistair Leslie-Hughes : comctl32/edit: Don' t set caret position when we don't have focus.

Alexandre Julliard julliard at winehq.org
Wed Dec 5 15:49:00 CST 2018


Module: wine
Branch: master
Commit: 929058a2ef890ab58ce7b5a2e5340d72f1adb64f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=929058a2ef890ab58ce7b5a2e5340d72f1adb64f

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Wed Dec  5 10:07:45 2018 +0300

comctl32/edit: Don't set caret position when we don't have focus.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/edit.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
index 06e1f49..1f17276 100644
--- a/dlls/comctl32/edit.c
+++ b/dlls/comctl32/edit.c
@@ -1707,9 +1707,14 @@ static LRESULT EDIT_EM_Scroll(EDITSTATE *es, INT action)
 static void EDIT_SetCaretPos(EDITSTATE *es, INT pos,
 			     BOOL after_wrap)
 {
-	LRESULT res = EDIT_EM_PosFromChar(es, pos, after_wrap);
-	TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res));
-	SetCaretPos((short)LOWORD(res), (short)HIWORD(res));
+    LRESULT res;
+
+    if (es->flags & EF_FOCUSED)
+    {
+        res = EDIT_EM_PosFromChar(es, pos, after_wrap);
+        TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res));
+        SetCaretPos((short)LOWORD(res), (short)HIWORD(res));
+    }
 }
 
 
@@ -1778,7 +1783,6 @@ static void EDIT_EM_ScrollCaret(EDITSTATE *es)
 		}
 	}
 
-    if(es->flags & EF_FOCUSED)
 	EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
 }
 




More information about the wine-cvs mailing list