Nikolay Sivov : user32/listbox: Scroll to specified caret index.
Alexandre Julliard
julliard at winehq.org
Wed Dec 11 16:35:00 CST 2019
Module: wine
Branch: master
Commit: b37b3f00a646d3836a4a26398b02a95612340699
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b37b3f00a646d3836a4a26398b02a95612340699
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Dec 11 15:17:49 2019 +0300
user32/listbox: Scroll to specified caret index.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/listbox.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 3949610e50..95f6a23a28 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -1473,19 +1473,23 @@ static void LISTBOX_MakeItemVisible( LB_DESCR *descr, INT index, BOOL fully )
*/
static LRESULT LISTBOX_SetCaretIndex( LB_DESCR *descr, INT index, BOOL fully_visible )
{
- INT oldfocus = descr->focus_item;
+ BOOL focus_changed = descr->focus_item != index;
- TRACE("old focus %d, index %d\n", oldfocus, index);
+ TRACE("old focus %d, index %d\n", descr->focus_item, index);
if (descr->style & LBS_NOSEL) return LB_ERR;
if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
- if (index == oldfocus) return LB_OKAY;
- LISTBOX_DrawFocusRect( descr, FALSE );
- descr->focus_item = index;
+ if (focus_changed)
+ {
+ LISTBOX_DrawFocusRect( descr, FALSE );
+ descr->focus_item = index;
+ }
LISTBOX_MakeItemVisible( descr, index, fully_visible );
- LISTBOX_DrawFocusRect( descr, TRUE );
+
+ if (focus_changed)
+ LISTBOX_DrawFocusRect( descr, TRUE );
return LB_OKAY;
}
More information about the wine-cvs
mailing list