From b6dc726bbd4b9c9b64569744b9df01f503c20e9d Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 23 Mar 2015 01:19:41 +0300 Subject: [PATCH] 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 57f19e4588f..2653155ddbc 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 0e3a5c9d407..3d439dff0c6 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); }