[4/4] comctl32/listview: Improve item position calculating in LVS_REPORT

Nikolay Sivov bunglehead at gmail.com
Mon May 25 19:51:09 CDT 2009


This patch is a step toward column reordering implementation (bug 3231).
Changes required to fix it entirely are rather wide (there's a lot of assumptions
in code that item is always at leftmost visible column). So I prefer to split
them and add tests for any change that's easy to test automatically.

Changelog:
    - use fixed padding in report mode
    - offset by column position

>From 4194674dc479a43c53f0f77bba9878415d3c8de0 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 26 May 2009 04:04:36 +0400
Subject: Improve item position calculating in LVS_REPORT

---
 dlls/comctl32/listview.c       |    5 ++++-
 dlls/comctl32/tests/listview.c |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 9f52d24..496e6de 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -1920,7 +1920,10 @@ static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *infoPtr, INT nItem, LPPO
     }
     else /* LVS_REPORT */
     {
-	lpptPosition->x = 0;
+	lpptPosition->x = REPORT_MARGINX;
+	/* item is always at zero indexed column */
+	if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
+	    lpptPosition->x += LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left;
 	lpptPosition->y = nItem * infoPtr->nItemHeight;
     }
 }
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 1a1ae06..47477a4 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -2538,7 +2538,7 @@ static void test_getitemposition(void)
     memset(&rect, 0, sizeof(rect));
     SendMessage(header, HDM_GETITEMRECT, 0, (LPARAM)&rect);
     /* some padding? */
-    todo_wine expect(2, pt.x);
+    expect(2, pt.x);
     /* offset by header height */
     expect(rect.bottom - rect.top, pt.y);
 
-- 
1.5.6.5





More information about the wine-patches mailing list