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.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@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.
With this patch, the first hover over the first entry will also work as it should.
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 239f54a..1f5d3c9 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -2337,7 +2337,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; }
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.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- 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 0122f92..f943839 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -2346,7 +2346,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; }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=89462
Your paranoid android.
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:11546: Test failed: got normal pos (200,88)-(400,288) win.c:11549: Test failed: got window rect (200,88)-(400,288) win.c:11562: Test failed: got normal pos (200,88)-(400,288)
Anything holding this up? It's really easy to test and a small change.