diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index f0a294e0009..0e22848d9d5 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -1027,6 +1027,20 @@ static inline DWORD notify_postpaint (const LISTVIEW_INFO *infoPtr, NMLVCUSTOMDR return notify_customdraw(infoPtr, CDDS_POSTPAINT, lpnmlvcd); } +static void notify_measureitem(LISTVIEW_INFO *infoPtr) +{ + MEASUREITEMSTRUCT mis; + mis.CtlType = ODT_LISTVIEW; + mis.CtlID = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); + mis.itemID = -1; + mis.itemWidth = 0; + mis.itemData = 0; + mis.itemHeight= infoPtr->nItemHeight; + SendMessageW(infoPtr->hwndNotify, WM_MEASUREITEM, mis.CtlID, (LPARAM)&mis); + if (infoPtr->nItemHeight != max(mis.itemHeight, 1)) + infoPtr->nMeasureItemHeight = infoPtr->nItemHeight = max(mis.itemHeight, 1); +} + /******** Item iterator functions **********************************/ static RANGES ranges_create(int count); @@ -8654,6 +8668,8 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) ShowWindow(infoPtr->hwndHeader, SW_SHOWNORMAL); } LISTVIEW_UpdateScroll(infoPtr); + /* send WM_MEASUREITEM notification */ + if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED) notify_measureitem(infoPtr); } OpenThemeData(hwnd, themeClass); @@ -10776,16 +10792,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS)) { - MEASUREITEMSTRUCT mis; - mis.CtlType = ODT_LISTVIEW; - mis.CtlID = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); - mis.itemID = -1; - mis.itemWidth = 0; - mis.itemData = 0; - mis.itemHeight= infoPtr->nItemHeight; - SendMessageW(infoPtr->hwndNotify, WM_MEASUREITEM, mis.CtlID, (LPARAM)&mis); - if (infoPtr->nItemHeight != max(mis.itemHeight, 1)) - infoPtr->nMeasureItemHeight = infoPtr->nItemHeight = max(mis.itemHeight, 1); + notify_measureitem(infoPtr); } LISTVIEW_UpdateSize(infoPtr); diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 820acc6eaf8..38155b16b7a 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -1405,7 +1405,7 @@ static void test_create(void) flush_sequences(sequences, NUM_MSG_SEQUENCES); hList = create_listview_control(LVS_OWNERDRAWFIXED); ok_sequence(sequences, PARENT_SEQ_INDEX, create_ownerdrawfixed_parent_seq, - "created with LVS_OWNERDRAWFIXED - parent seq", TRUE); + "created with LVS_OWNERDRAWFIXED|LVS_REPORT - parent seq", FALSE); DestroyWindow(hList); }