[PATCH 1/2] user32: Use correct values to deselect combo box text with EM_SETSEL

Dmitry Timoshkov dmitry at baikal.ru
Mon Jan 25 05:42:13 CST 2016


Hugh McMaster <hugh.mcmaster at outlook.com> wrote:

> >> diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
> >> index c744ee5..4c57b72 100644
> >> --- a/dlls/user32/combo.c
> >> +++ b/dlls/user32/combo.c
> >> @@ -1189,6 +1189,8 @@ static void COMBO_KillFocus( LPHEADCOMBO lphc )
> >>         {
> >>             if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
> >>                 SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
> >> +           else
> >> +               SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, 0);
> > 
> > The message test doesn't confirm that this is a correct solution.
> 
> I tested the sequence from WM_KILLFOCUS twice in dlls/user32/tests/msg.c.
> 
> static const struct message SetFocusButtonSeq[] =
> {
>     { WM_KILLFOCUS, sent },
>     { CB_GETCOMBOBOXINFO, sent|optional },/* Windows 2000 */
>     { 0x0167, sent|optional },/* Undocumented message. Sent on all versions except Windows 2000 */
>     { WM_LBUTTONUP, sent|defwinproc },
>     { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_COMBOBOX, CBN_SELENDCANCEL) },
>     { EM_SETSEL, sent|defwinproc|wparam|lparam, 0, 0 },
>     { WM_CTLCOLOREDIT, sent|defwinproc|optional },/* Not sent on W2000, XP or Server 2003 */
>     { WM_CTLCOLOREDIT, sent|parent|optional },/* Not sent on W2000, XP or Server 2003 */
>     { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_COMBOBOX, CBN_KILLFOCUS) },
>     { WM_CTLCOLORBTN, sent|parent },
>     { 0 }
> };
> 
> static const struct message SetFocusButtonSeq2[] =
> {
>     { WM_KILLFOCUS, sent },
>     { CB_GETCOMBOBOXINFO, sent|optional },/* Windows 2000 */
>     { 0x0167, sent|optional },/* Undocumented message. Sent on all versions except Windows 2000 */
>     { WM_LBUTTONUP, sent|defwinproc },
>     { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_COMBOBOX, CBN_SELENDCANCEL) },
>     { EM_SETSEL, sent|defwinproc|wparam|lparam, 0, 0 },
>     { WM_CTLCOLOREDIT, sent|defwinproc },
>     { WM_CTLCOLOREDIT, sent|parent },
>     { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_COMBOBOX, CBN_KILLFOCUS) },
>     { WM_CTLCOLORBTN, sent|parent },
>     { 0 }
> };
> 
> In both sequences, the expected value of EM_SETSEL is 0, 0.
> 
> Perhaps I'm not understanding what you mean in this case.

I mean that adding a SendMessage() call should fix the message sequence
if that's how it's supposed to work, and as a result you would remove TRUE
as an indicator of todo_wine for fixed sequences.

-- 
Dmitry.



More information about the wine-devel mailing list