[4/5] comctl32/listview: do not touch icon spacing if set explicitly

Daniel Jelinski djelinski1 at gmail.com
Sat Jan 19 17:17:37 CST 2013


-------------- next part --------------
From 57b7aa2c4fc8f8ea4c95336ea333201539b56c6c Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sat, 19 Jan 2013 23:58:51 +0100
Subject: comctl32/listview: do not touch icon spacing if set explicitly

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

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 512dfbf..b8df878 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -55,7 +55,6 @@
  *   -- LVA_SNAPTOGRID not implemented
  *   -- LISTVIEW_ApproximateViewRect partially implemented
  *   -- LISTVIEW_SetColumnWidth ignores header images & bitmap
- *   -- LISTVIEW_SetIconSpacing is incomplete
  *   -- LISTVIEW_StyleChanged doesn't handle some changes too well
  *
  * Speedups
@@ -291,6 +290,7 @@ typedef struct tagLISTVIEW_INFO
   HIMAGELIST himlSmall;
   HIMAGELIST himlState;
   SIZE iconSize;
+  BOOL autoSpacing;
   SIZE iconSpacing;
   SIZE iconStateSize;
   POINT currIconPos;        /* this is the position next icon will be placed */
@@ -8585,11 +8585,15 @@ static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
     /* set to defaults, if instructed to */
     if (cx == -1 && cy == -1)
     {
+        infoPtr->autoSpacing = TRUE;
         if (infoPtr->himlNormal)
             ImageList_GetIconSize(infoPtr->himlNormal, &iconWidth, &iconHeight);
         cx = GetSystemMetrics(SM_CXICONSPACING) - GetSystemMetrics(SM_CXICON) + iconWidth;
         cy = GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON) + iconHeight;
     }
+    else
+        infoPtr->autoSpacing = FALSE;
+
     /* if 0 then keep width */
     if (cx != 0)
         infoPtr->iconSpacing.cx = cx;
@@ -8651,7 +8655,8 @@ static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAG
         himlOld = infoPtr->himlNormal;
         infoPtr->himlNormal = himl;
         if (infoPtr->uView == LV_VIEW_ICON) set_icon_size(&infoPtr->iconSize, himl, FALSE);
-        LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
+        if (infoPtr->autoSpacing)
+            LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
     break;
 
     case LVSIL_SMALL:
@@ -9365,6 +9370,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
   infoPtr->bRedraw = TRUE;
   infoPtr->bNoItemMetrics = TRUE;
   infoPtr->bDoChangeNotify = TRUE;
+  infoPtr->autoSpacing = TRUE;
   infoPtr->iconSpacing.cx = GetSystemMetrics(SM_CXICONSPACING) - GetSystemMetrics(SM_CXICON);
   infoPtr->iconSpacing.cy = GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON);
   infoPtr->nEditLabelItem = -1;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 3097f73..4b4e341 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -4647,7 +4647,6 @@ static void test_getitemspacing(void)
 
     ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0);
     /* set size returned */
-todo_wine {
     expect(100, LOWORD(ret));
     expect(100, HIWORD(ret));
 
@@ -4658,13 +4657,12 @@ todo_wine {
 
     ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0);
     expect(100, LOWORD(ret));
-}
+
     expect(0xFFFF, HIWORD(ret));
 
 #ifdef _WIN64
     /* NOTE: -1 is not treated the same as (DWORD)-1 by 64bit listview */
     ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, (DWORD)-1);
-todo_wine
     expect(100, LOWORD(ret));
     expect(0xFFFF, HIWORD(ret));
 
@@ -4679,7 +4677,6 @@ todo_wine {
     ok(0xDEADBEEF == ret2, "Expected 00000000DEADBEEF, got %p\n", (void*)ret2);
 #else
     ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, -1);
-todo_wine
     expect(100, LOWORD(ret));
     expect(0xFFFF, HIWORD(ret));
 #endif
-- 
1.7.5.4


More information about the wine-patches mailing list