comctl32/listview: fix calculating item height

Daniel Jelinski djelinski1 at gmail.com
Sat Jan 5 08:30:24 CST 2013


-------------- next part --------------
From 5a75c27e4c7df635621e01f8302fe5aa0a4f03e0 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sat, 5 Jan 2013 15:04:53 +0100
Subject: [PATCH] comctl32/listview: fix calculating item height

HEIGHT_PADDING is defined as 1. From my testing, item height is always font size + 1 or icon size + 1, whichever is larger.
Tested SMALLICON,LIST and REPORT modes, with and without image lists, with and without grid lines.
This was second issue in http://bugs.winehq.org/show_bug.cgi?id=9491#c10
---
 dlls/comctl32/listview.c       |    7 ++-----
 dlls/comctl32/tests/listview.c |    2 --
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 977bb18..dfa8d6e 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -2954,15 +2954,12 @@ static INT LISTVIEW_CalculateItemHeight(const LISTVIEW_INFO *infoPtr)
 	nItemHeight = infoPtr->iconSpacing.cy;
     else
     {
-	nItemHeight = infoPtr->ntmHeight; 
-        if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
-            nItemHeight++;
+	nItemHeight = infoPtr->ntmHeight;
 	if (infoPtr->himlState)
 	    nItemHeight = max(nItemHeight, infoPtr->iconStateSize.cy);
 	if (infoPtr->himlSmall)
 	    nItemHeight = max(nItemHeight, infoPtr->iconSize.cy);
-	if (infoPtr->himlState || infoPtr->himlSmall)
-	    nItemHeight += HEIGHT_PADDING;
+	nItemHeight += HEIGHT_PADDING;
     if (infoPtr->nMeasureItemHeight > 0)
         nItemHeight = infoPtr->nMeasureItemHeight;
     }
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 0620afe..0a42dad 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -2432,7 +2432,6 @@ static void test_subitem_rect(void)
 
     expect(100, rect.left);
     expect(250, rect.right);
-todo_wine
     expect(3, rect.top);
 
     rect.left = LVIR_BOUNDS;
@@ -2443,7 +2442,6 @@ todo_wine
 
     expect(250, rect.left);
     expect(450, rect.right);
-todo_wine
     expect(3, rect.top);
 
     /* item LVS_REPORT padding isn't applied to subitems */
-- 
1.7.5.4


More information about the wine-patches mailing list