Nikolay Sivov : comctl32/listview: Update view on style change only if LVS_TYPEMASK styles have changed.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 23 10:03:19 CDT 2015


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Mar 23 01:19:41 2015 +0300

comctl32/listview: Update view on style change only if LVS_TYPEMASK styles have changed.

---

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

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 57f19e4..2653155 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -11067,7 +11067,6 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
     if (wStyleType != GWL_STYLE) return 0;
 
     infoPtr->dwStyle = lpss->styleNew;
-    map_style_view(infoPtr);
 
     if (((lpss->styleOld & WS_HSCROLL) != 0)&&
         ((lpss->styleNew & WS_HSCROLL) == 0))
@@ -11080,7 +11079,10 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
     if (uNewView != uOldView)
     {
     	HIMAGELIST himl;
-    
+
+        /* LVM_SETVIEW doesn't change window style bits within LVS_TYPEMASK,
+           changing style updates current view only when view bits change. */
+        map_style_view(infoPtr);
         SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
     	ShowWindow(infoPtr->hwndHeader, SW_HIDE);
 
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 0e3a5c9..3d439df 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -4554,6 +4554,12 @@ static void test_get_set_view(void)
     style = GetWindowLongPtrA(hwnd, GWL_STYLE);
     ok(style & LVS_LIST, "Expected style to be preserved\n");
 
+    /* now change window style to see if view is remapped */
+    style = GetWindowLongPtrA(hwnd, GWL_STYLE);
+    SetWindowLongPtrA(hwnd, GWL_STYLE, style | LVS_SHOWSELALWAYS);
+    ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
+    expect(LV_VIEW_SMALLICON, ret);
+
     DestroyWindow(hwnd);
 }
 




More information about the wine-cvs mailing list