comctl32/listview: Fix a regression caused by 59148d0bb549ff8690f15f14571a715e3fdd43a5 (try2)
Nikolay Sivov
bunglehead at gmail.com
Mon Apr 13 17:49:25 CDT 2009
I've found another one regression runnning a test application from
http://bugs.winehq.org/show_bug.cgi?id=8028
On 1.1.19 you won't see a listview at all until main window resizing.
Attached patch fixes this, a previous change for http://bugs.winehq.org/show_bug.cgi?id=18007
is still here.
Changelog:
- more tests added
- another regression catched testing bug 8028
- Fix a regression caused by 59148d0bb549ff8690f15f14571a715e3fdd43a5
>From f54765b782673024d91147b326aaf30aa08e8cda Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Mon, 13 Apr 2009 18:42:57 -0400
Subject: 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 e571f33..7d2bc1d 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -1399,6 +1399,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;
}
@@ -1674,6 +1676,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;
@@ -8140,7 +8144,6 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
{
ShowWindow(infoPtr->hwndHeader, SW_SHOWNORMAL);
}
- LISTVIEW_UpdateSize(infoPtr);
LISTVIEW_UpdateScroll(infoPtr);
}
@@ -9124,7 +9127,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 914be42..57d0bb7 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)
--
1.5.6.5
More information about the wine-patches
mailing list