From: "Gabriel Ivăncescu" Subject: [PATCH resend 2/2] user32/listbox: Set the selection if it's currently invalid in HandleTimer. Message-Id: <55f70bc928dde2f8c4ce52895f30fea68d4a0110.1575647930.git.gabrielopcode@gmail.com> Date: Fri, 6 Dec 2019 17:59:02 +0200 In-Reply-To: <0a22d14d95b4dd09e112e972aa11e47a54a2e0fb.1575647930.git.gabrielopcode@gmail.com> References: <0a22d14d95b4dd09e112e972aa11e47a54a2e0fb.1575647930.git.gabrielopcode@gmail.com> Don't skip MoveCaret if it would actually change the selection when it is invalid. This can happen, for example, in a combo box if the dropdown is shown by a mouse click + release followed by the mouse being moved into the dropped listbox, when the listbox has nothing selected. In this case, the item with the index zero would not be selected the first time the mouse moves over it, since the focus_item would be zero, despite the fact the item is not selected. Signed-off-by: Gabriel Ivăncescu --- dlls/user32/listbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 3949610..7051449 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -2347,7 +2347,7 @@ static LRESULT LISTBOX_HandleTimer( LB_DESCR *descr, INT index, TIMER_DIRECTION case LB_TIMER_NONE: break; } - if (index == descr->focus_item) return FALSE; + if (index == descr->focus_item && descr->selected_item != -1) return FALSE; LISTBOX_MoveCaret( descr, index, FALSE ); return TRUE; } -- 2.21.0