Nikolay Sivov : comctl32/listview: Fix a regression caused by 59148d0bb549ff8690f15f14571a715e3fdd43a5.

Alexandre Julliard julliard at winehq.org
Tue Apr 14 16:00:00 CDT 2009


Module: wine
Branch: master
Commit: e014484a4365a49cbd2e62f7df0a4b513e779d6a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e014484a4365a49cbd2e62f7df0a4b513e779d6a

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Mon Apr 13 18:42:57 2009 -0400

comctl32/listview: Fix a regression caused by 59148d0bb549ff8690f15f14571a715e3fdd43a5.

---

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

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index d26f7b0..94ab7c9 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -1398,6 +1398,8 @@ static INT LISTVIEW_CreateHeader(LISTVIEW_INFO *infoPtr)
     /* set header font */
     SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, (LPARAM)TRUE);
 
+    LISTVIEW_UpdateSize(infoPtr);
+
     return 0;
 }
 
@@ -1673,6 +1675,8 @@ static void LISTVIEW_UpdateHeaderSize(const LISTVIEW_INFO *infoPtr, INT nNewScro
 
     TRACE("nNewScrollPos=%d\n", nNewScrollPos);
 
+    if (!infoPtr->hwndHeader)  return;
+
     GetWindowRect(infoPtr->hwndHeader, &winRect);
     point[0].x = winRect.left;
     point[0].y = winRect.top;
@@ -8143,7 +8147,6 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
     {
       ShowWindow(infoPtr->hwndHeader, SW_SHOWNORMAL);
     }
-    LISTVIEW_UpdateSize(infoPtr);
     LISTVIEW_UpdateScroll(infoPtr);
   }
 
@@ -9127,7 +9130,7 @@ static LRESULT LISTVIEW_Paint(LISTVIEW_INFO *infoPtr, HDC hdc)
 	LISTVIEW_UpdateScroll(infoPtr);
     }
 
-    UpdateWindow(infoPtr->hwndHeader);
+    if (infoPtr->hwndHeader)  UpdateWindow(infoPtr->hwndHeader);
 
     if (hdc) 
         LISTVIEW_Refresh(infoPtr, hdc, NULL);
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 7f6a540..d08ca2f 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -903,14 +903,14 @@ static void test_create(void)
                           (GetWindowLongPtr(hList, GWL_STYLE) & ~LVS_LIST) | LVS_REPORT);
     ok(((ret & WS_VISIBLE) && (ret & LVS_LIST)), "Style wrong, should have WS_VISIBLE|LVS_LIST\n");
     hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
-    ok(IsWindow(hHeader), "Header shouldn't be created\n");
-    ok(hHeader == GetDlgItem(hList, 0), "NULL dialog item expected\n");
+    ok(IsWindow(hHeader), "Header should be created\n");
+    ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
     ret = SetWindowLongPtr(hList, GWL_STYLE,
                           (GetWindowLongPtr(hList, GWL_STYLE) & ~LVS_REPORT) | LVS_LIST);
     ok(((ret & WS_VISIBLE) && (ret & LVS_REPORT)), "Style wrong, should have WS_VISIBLE|LVS_REPORT\n");
     hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
-    ok(IsWindow(hHeader), "Header shouldn't be created\n");
-    ok(hHeader == GetDlgItem(hList, 0), "NULL dialog item expected\n");
+    ok(IsWindow(hHeader), "Header should be created\n");
+    ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
     DestroyWindow(hList);
 
     /* LVS_REPORT without WS_VISIBLE */
@@ -941,6 +941,16 @@ static void test_create(void)
     ok(IsWindow(hHeader), "Header should be created\n");
     ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
     DestroyWindow(hList);
+
+    /* LVS_REPORT with LVS_NOCOLUMNHEADER */
+    hList = CreateWindow("SysListView32", "Test", LVS_REPORT|LVS_NOCOLUMNHEADER|WS_VISIBLE,
+                          0, 0, 100, 100, NULL, NULL, GetModuleHandle(NULL), 0);
+    hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+    ok(IsWindow(hHeader), "Header should be created\n");
+    ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
+    /* HDS_DRAGDROP set by default */
+    ok(GetWindowLongPtr(hHeader, GWL_STYLE) & HDS_DRAGDROP, "Expected header to have HDS_DRAGDROP\n");
+    DestroyWindow(hList);
 }
 
 static void test_redraw(void)




More information about the wine-cvs mailing list