diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index d63c23a6599b22077e2b34ef62fce7671f9a759a..200bf93be5503c7315a218b4bb28ae3cf0217da5 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -11108,14 +11108,13 @@ static void LISTVIEW_UpdateSize(LISTVIEW_INFO *infoPtr) static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss) { - UINT uNewView = lpss->styleNew & LVS_TYPEMASK; - UINT uOldView = lpss->styleOld & LVS_TYPEMASK; + UINT uNewView, uOldView; UINT style; TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n", wStyleType, lpss->styleOld, lpss->styleNew); - if (wStyleType != GWL_STYLE) return 0; + if (wStyleType != GWL_STYLE || lpss->styleNew == infoPtr->dwStyle) return 0; infoPtr->dwStyle = lpss->styleNew; @@ -11127,6 +11126,9 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, ((lpss->styleNew & WS_VSCROLL) == 0)) ShowScrollBar(infoPtr->hwndSelf, SB_VERT, FALSE); + uNewView = lpss->styleNew & LVS_TYPEMASK; + uOldView = lpss->styleOld & LVS_TYPEMASK; + if (uNewView != uOldView) { HIMAGELIST himl; diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index c9a165c39c9d4b34736849ef0d45785b8ff2fcba..c2d33c41f56ba6ff4ebd623f39ae443ca9af467c 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -1781,6 +1781,7 @@ static void test_redraw(void) HDC hdc; BOOL res; DWORD r; + RECT rect; hwnd = create_listview_control(LVS_REPORT); subclass_header(hwnd); @@ -1838,6 +1839,13 @@ static void test_redraw(void) ReleaseDC(hwndparent, hdc); + /* test setting the window style to what it already was */ + UpdateWindow(hwnd); + SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE)); + GetUpdateRect(hwnd, &rect, FALSE); + ok(rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0, + "Expected empty update rect, got %s\n", wine_dbgstr_rect(&rect)); + DestroyWindow(hwnd); }