[2/2] comctl32/listview: Partial fix for LVM_GETSUBITEMRECT for item == -1

Nikolay Sivov bunglehead at gmail.com
Wed Apr 22 13:02:09 CDT 2009


http://bugs.winehq.org/show_bug.cgi?id=9491

This fixes most unimlemented things for this case except one:
wrong "top" reported, I didn't figure out yet where a problem is.
No test cases exist yte for everything but LVIR_BOUNDS so
I've placed a FIXME for that.

Changelog:
    - Partial fix for LVM_GETSUBITEMRECT for item == -1

>From 47ed9165045120b13a4a94a51cac68a943bb750c Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 22 Apr 2009 13:51:02 -0400
Subject: Partial fix for LVM_GETSUBITEMRECT for item = -1

---
 dlls/comctl32/listview.c       |   18 ++++++++++++++++++
 dlls/comctl32/tests/listview.c |   13 ++++++-------
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index e6fa8ec..c6a06c7 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -5984,6 +5984,24 @@ static BOOL LISTVIEW_GetSubItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPR
 
     if ((infoPtr->dwStyle & LVS_TYPEMASK) != LVS_REPORT) return FALSE;
 
+    /* special case for header items */
+    if (nItem == -1)
+    {
+        if (lprc->left != LVIR_BOUNDS)
+        {
+            FIXME("Only LVIR_BOUNDS is implemented for header, got %d\n", lprc->left);
+            return FALSE;
+        }
+
+        if (infoPtr->hwndHeader)
+            return Header_GetItemRect(infoPtr->hwndHeader, lprc->top, lprc);
+        else
+        {
+            memset(lprc, 0, sizeof(RECT));
+            return TRUE;
+        }
+    }
+
     if (!LISTVIEW_GetItemPosition(infoPtr, nItem, &Position)) return FALSE;
 
     if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index fba7a01..61dca76 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -988,7 +988,6 @@ static void test_create(void)
     rect.top  = 1;
     rect.right = rect.bottom = -10;
     r = SendMessage(hList, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
-todo_wine
     ok(r != 0, "Expected not-null LRESULT\n");
 
     hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
@@ -996,11 +995,10 @@ todo_wine
     ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
 
     expect(0, rect.left);
-todo_wine {
     expect(0, rect.right);
     expect(0, rect.top);
     expect(0, rect.bottom);
-}
+
     DestroyWindow(hList);
 }
 
@@ -1537,22 +1535,23 @@ static void test_subitem_rect(void)
     rect.top  = 1;
     rect.right = rect.bottom = 0;
     r = SendMessage(hwnd, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
-todo_wine{
+
     ok(r != 0, "Expected not-null LRESULT\n");
     expect(100, rect.left);
     expect(250, rect.right);
+todo_wine
     expect(3, rect.top);
-}
+
     rect.left = LVIR_BOUNDS;
     rect.top  = 2;
     rect.right = rect.bottom = 0;
     r = SendMessage(hwnd, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect);
-todo_wine{
+
     ok(r != 0, "Expected not-null LRESULT\n");
     expect(250, rect.left);
     expect(450, rect.right);
+todo_wine
     expect(3, rect.top);
-}
 
     DestroyWindow(hwnd);
 
-- 
1.5.6.5





More information about the wine-patches mailing list