https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fb43301bad62b3ae290b7…
commit fb43301bad62b3ae290b784c64227ea7d63fe533
Author: Doug Lyons <douglyons(a)douglyons.com>
AuthorDate: Wed Jan 17 09:42:18 2024 -0600
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jan 17 07:42:18 2024 -0800
Fix Cursor Position in "...file name:" box when opening from Explorer
'Search' toolbar (#6333)
Original patch by @I_Kill_Bugs.
Fix Cursor being in middle of '...file name:' edit box when using
'Search' from the Explorer toolbar.
JIRA issue: CORE-19407
---
dll/win32/comctl32/edit.c | 5 +++++
win32ss/user/user32/controls/edit.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/dll/win32/comctl32/edit.c b/dll/win32/comctl32/edit.c
index 5185605eb72..fc6b53755ef 100644
--- a/dll/win32/comctl32/edit.c
+++ b/dll/win32/comctl32/edit.c
@@ -1752,6 +1752,11 @@ static void EDIT_SetCaretPos(EDITSTATE *es, INT pos,
#ifdef __REACTOS__
HKL hKL = GetKeyboardLayout(0);
POINT pt = { (short)LOWORD(res), (short)HIWORD(res) };
+
+ /* Don't set caret if not focused */
+ if ((es->flags & EF_FOCUSED) == 0)
+ return;
+
SetCaretPos(pt.x, pt.y);
if (!ImmIsIME(hKL))
diff --git a/win32ss/user/user32/controls/edit.c b/win32ss/user/user32/controls/edit.c
index d48e8e3b034..9b0eac86988 100644
--- a/win32ss/user/user32/controls/edit.c
+++ b/win32ss/user/user32/controls/edit.c
@@ -1907,6 +1907,11 @@ static void EDIT_SetCaretPos(EDITSTATE *es, INT pos,
#ifdef __REACTOS__
HKL hKL = GetKeyboardLayout(0);
POINT pt = { (short)LOWORD(res), (short)HIWORD(res) };
+
+ /* Don't set caret if not focused */
+ if ((es->flags & EF_FOCUSED) == 0)
+ return;
+
SetCaretPos(pt.x, pt.y);
if (!ImmIsIME(hKL))