https://git.reactos.org/?p=reactos.git;a=commitdiff;h=71ab0b5d4cb7fe00e0047…
commit 71ab0b5d4cb7fe00e0047308a18ae48c734266b9
Author: Manuel Bachmann <tarnyko(a)tarnyko.net>
AuthorDate: Thu Nov 2 02:06:50 2017 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sun Aug 19 14:24:34 2018 +0200
[NTDLL][NTUSER] Fix unselected text after WM_CBLOSTTEXTFOCUS
When we unselect text after the WM_CBLOSTTEXTFOCUS message,
make sure we also forget we have been focused at all;
otherwise the edit may become focused again, but with an
empty text selection.
CORE-10266
---
win32ss/user/user32/controls/combo.c | 16 +++++++---------
win32ss/user/user32/controls/edit.c | 11 +----------
2 files changed, 8 insertions(+), 19 deletions(-)
diff --git a/win32ss/user/user32/controls/combo.c b/win32ss/user/user32/controls/combo.c
index eb9d6fd86d..11537901e5 100644
--- a/win32ss/user/user32/controls/combo.c
+++ b/win32ss/user/user32/controls/combo.c
@@ -2260,16 +2260,14 @@ LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message,
WPARAM wParam, LPAR
}
break;
- case WM_CBLOSTTEXTFOCUS: /* undocumented message - deselects the text when focus
is lost */
+ case WM_CBLOSTTEXTFOCUS: /* undocumented message - deselects the text when focus is
lost */
+ if (lphc->hWndEdit != NULL)
{
- if (lphc->hWndEdit != NULL)
- {
- SendMessage(lphc->self, WM_LBUTTONUP, 0, 0xFFFFFFFF);
- SendMessage(lphc->hWndEdit, EM_SETSEL, 0, 0);
- lphc->wState &= ~CBF_FOCUSED;
- CB_NOTIFY(lphc, CBN_KILLFOCUS);
- }
- }
+ SendMessage(lphc->self, WM_LBUTTONUP, 0, 0xFFFFFFFF);
+ SendMessage(lphc->hWndEdit, EM_SETSEL, 0, 0);
+ lphc->wState &= ~(CBF_FOCUSED | CBF_BEENFOCUSED);
+ CB_NOTIFY(lphc, CBN_KILLFOCUS);
+ }
return TRUE;
#endif
diff --git a/win32ss/user/user32/controls/edit.c b/win32ss/user/user32/controls/edit.c
index f1db16f8e0..70bdd1d40d 100644
--- a/win32ss/user/user32/controls/edit.c
+++ b/win32ss/user/user32/controls/edit.c
@@ -3626,7 +3626,6 @@ static LRESULT EDIT_WM_KeyDown(EDITSTATE *es, INT key)
*/
static LRESULT EDIT_WM_KillFocus(EDITSTATE *es)
{
-#if 0 // See CORE-10266.
HWND hCombo;
LONG lStyles;
@@ -3647,15 +3646,7 @@ static LRESULT EDIT_WM_KillFocus(EDITSTATE *es)
if ((lStyles & CBS_DROPDOWN) || (lStyles & CBS_SIMPLE))
SendMessage(hCombo, WM_CBLOSTTEXTFOCUS, 0, 0);
}
-#else
- es->flags &= ~EF_FOCUSED;
- DestroyCaret();
- if(!(es->style & ES_NOHIDESEL))
- EDIT_InvalidateText(es, es->selection_start, es->selection_end);
- EDIT_NOTIFY_PARENT(es, EN_KILLFOCUS);
- /* throw away left over scroll when we lose focus */
- es->wheelDeltaRemainder = 0;
-#endif
+
return 0;
}