https://git.reactos.org/?p=reactos.git;a=commitdiff;h=733a32dadeb58715ef43a…
commit 733a32dadeb58715ef43af076de828c811ed5595
Author: Charles Ambrye <giawa(a)hotmail.com>
AuthorDate: Sun Apr 19 19:41:54 2020 -0700
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
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);
}