From: Haoyang Chen chenhaoyang@kylinos.cn
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=4405 --- dlls/user32/combo.c | 4 +++- dlls/user32/tests/combo.c | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index 7486385ac37..bc68c203953 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -1132,6 +1132,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd ) TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
COMBO_SetFocus( lphc ); + SendMessageW( lphc->hWndEdit, EM_SETSEL, 0, INT_MAX ); break;
case (EN_KILLFOCUS >> 8): @@ -1145,6 +1146,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd ) */
COMBO_KillFocus( lphc ); + SendMessageW( lphc->hWndEdit, EM_SETSEL, 0, 0 ); break;
@@ -1759,7 +1761,7 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar NtUserSetFocus( lphc->hWndEdit ); /* The first time focus is received, select all the text */ if( !(lphc->wState & CBF_BEENFOCUSED) ) { - SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1); + SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, INT_MAX); lphc->wState |= CBF_BEENFOCUSED; } } diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index 2fc0d1ad9c0..4d454c4b2c2 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -626,20 +626,20 @@ static void test_editselection_focus(DWORD style)
SendMessageA(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit); ok(setsel_start == 0, "Unexpected EM_SETSEL start value; got %ld\n", setsel_start); - todo_wine ok(setsel_end == INT_MAX, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end); + ok(setsel_end == INT_MAX, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end); ok(hCBN_SetFocus == hCombo, "Wrong handle set by CBN_SETFOCUS; got %p\n", hCBN_SetFocus); ok(GetFocus() == hEdit, "hEdit should have keyboard focus\n");
SendMessageA(hMainWnd, WM_NEXTDLGCTL, (WPARAM)hButton, TRUE); ok(setsel_start == 0, "Unexpected EM_SETSEL start value; got %ld\n", setsel_start); - todo_wine ok(setsel_end == 0, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end); + ok(setsel_end == 0, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end); ok(hCBN_KillFocus == hCombo, "Wrong handle set by CBN_KILLFOCUS; got %p\n", hCBN_KillFocus); ok(GetFocus() == hButton, "hButton should have keyboard focus\n");
SendMessageA(hCombo, WM_SETTEXT, 0, (LPARAM)wine_test); SendMessageA(hMainWnd, WM_NEXTDLGCTL, (WPARAM)hCombo, TRUE); ok(setsel_start == 0, "Unexpected EM_SETSEL start value; got %ld\n", setsel_start); - todo_wine ok(setsel_end == INT_MAX, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end); + ok(setsel_end == INT_MAX, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end); ok(hCBN_SetFocus == hCombo, "Wrong handle set by CBN_SETFOCUS; got %p\n", hCBN_SetFocus); ok(GetFocus() == hEdit, "hEdit should have keyboard focus\n"); SendMessageA(hCombo, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer); @@ -647,7 +647,7 @@ static void test_editselection_focus(DWORD style)
SendMessageA(hMainWnd, WM_NEXTDLGCTL, (WPARAM)hButton, TRUE); ok(setsel_start == 0, "Unexpected EM_SETSEL start value; got %ld\n", setsel_start); - todo_wine ok(setsel_end == 0, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end); + ok(setsel_end == 0, "Unexpected EM_SETSEL end value; got %ld\n", setsel_end); ok(hCBN_KillFocus == hCombo, "Wrong handle set by CBN_KILLFOCUS; got %p\n", hCBN_KillFocus); ok(GetFocus() == hButton, "hButton should have keyboard focus\n"); len = SendMessageA(hCombo, CB_GETEDITSEL, 0, 0);