[PATCH resend 1/2] comctl32: Set the selection if it's currently invalid in HandleTimer.

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Jun 9 13:46:42 CDT 2022


This can happen 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 first item (with the
index zero) would not be selected the first time the mouse moves over it.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

This can be easily tested with winecfg. Launch winecfg, go to `Libraries`
tab, click on the combobox arrow dropdown for `New override for library`
to open the listbox, then hover the mouse over the first entry (acledit).

Notice that it does not get highlighted, which is the issue. If you move
the mouse to the second entry (aclui) and then back to (acledit), it works.

 dlls/comctl32/listbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 6724dee..2942952 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -2339,7 +2339,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.34.1




More information about the wine-devel mailing list