[PATCH v2 05/10] comctl32/listbox: Use a helper to retrieve item data by index
Gabriel Ivăncescu
gabrielopcode at gmail.com
Mon Feb 11 11:03:08 CST 2019
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/comctl32/listbox.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index c84d317..ec6a169 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -160,6 +160,11 @@ static BOOL is_item_selected( const LB_DESCR *descr, UINT index )
return descr->items[index].selected;
}
+static ULONG_PTR get_item_data( const LB_DESCR *descr, UINT index )
+{
+ return (descr->style & LBS_NODATA) ? 0 : descr->items[index].data;
+}
+
/***********************************************************************
* LISTBOX_GetCurrentPageSize
*
@@ -565,7 +570,7 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
if (focused)
dis.itemState |= ODS_FOCUS;
if (!IsWindowEnabled(descr->self)) dis.itemState |= ODS_DISABLED;
- dis.itemData = item ? item->data : 0;
+ dis.itemData = get_item_data(descr, index);
dis.rcItem = *rect;
TRACE("[%p]: drawitem %d (%s) action=%02x state=%02x rect=%s\n",
descr->self, index, item ? debugstr_w(item->str) : "", action,
--
2.20.1
More information about the wine-devel
mailing list