https://git.reactos.org/?p=reactos.git;a=commitdiff;h=733a32dadeb58715ef43af076de828c811ed5595

commit 733a32dadeb58715ef43af076de828c811ed5595
Author:     Charles Ambrye <[email protected]>
AuthorDate: Sun Apr 19 19:41:54 2020 -0700
Commit:     Giannis Adamopoulos <[email protected]>
CommitDate: Mon Apr 20 23:13:09 2020 +0300

    [LISTVIEW] Add basic support for LVS_EX_SNAPTOGRID
---
 dll/win32/comctl32/listview.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/dll/win32/comctl32/listview.c b/dll/win32/comctl32/listview.c
index 7a3eeec5404..e26457b48dc 100644
--- a/dll/win32/comctl32/listview.c
+++ b/dll/win32/comctl32/listview.c
@@ -8749,6 +8749,13 @@ static DWORD 
LISTVIEW_SetExtendedListViewStyle(LISTVIEW_INFO *infoPtr, DWORD mas
         LISTVIEW_UpdateScroll(infoPtr);
     }
 
+#ifdef __REACTOS__
+    if ((infoPtr->dwLvExStyle & LVS_EX_SNAPTOGRID) > (old_ex_style & 
LVS_EX_SNAPTOGRID))
+    {
+        LISTVIEW_Arrange(infoPtr, LVA_SNAPTOGRID);
+    }
+#endif
+
     LISTVIEW_InvalidateList(infoPtr);
     return old_ex_style;
 }
@@ -9082,6 +9089,14 @@ static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO 
*infoPtr, INT nItem, const PO
     Pt.x -= Origin.x;
     Pt.y -= Origin.y;
 
+#ifdef __REACTOS__
+    if (infoPtr->dwLvExStyle & LVS_EX_SNAPTOGRID)
+    {
+        Pt.x = max(0, Pt.x + (infoPtr->nItemWidth >> 1) - (Pt.x + 
(infoPtr->nItemWidth >> 1)) % infoPtr->nItemWidth);
+        Pt.y = max(0, Pt.y + (infoPtr->nItemHeight >> 1) - (Pt.y + 
(infoPtr->nItemHeight >> 1)) % infoPtr->nItemHeight);
+    }
+#endif
+
     return LISTVIEW_MoveIconTo(infoPtr, nItem, &Pt, FALSE);
 }
 

Reply via email to