https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b931f643e35e6a23dbef9…
commit b931f643e35e6a23dbef99e785804039ea579b6a
Author: Joachim Henze <Joachim.Henze(a)reactos.org>
AuthorDate: Wed Nov 13 00:30:00 2019 +0100
Commit: Joachim Henze <Joachim.Henze(a)reactos.org>
CommitDate: Wed Nov 13 00:30:00 2019 +0100
[COMCTL32] Fix listview scrollbars flashing CORE-16466
Many Thanks to patches author JIRA user 'I_Kill_Bugs',
but also to Doug Lyons and Fabian Maurer.
Unhidden by SVN r75735 == git 0.4.7-dev-168-g
6af37fd54e53658bb4d832d01e4ee2546af98835
I will merge that back into 0.4.13-RC as well.
---
dll/win32/comctl32/listview.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/dll/win32/comctl32/listview.c b/dll/win32/comctl32/listview.c
index 764a127f78b..79012f8a1f1 100644
--- a/dll/win32/comctl32/listview.c
+++ b/dll/win32/comctl32/listview.c
@@ -2088,6 +2088,9 @@ static INT LISTVIEW_UpdateHScroll(LISTVIEW_INFO *infoPtr)
horzInfo.fMask = SIF_RANGE | SIF_PAGE;
horzInfo.nMax = max(horzInfo.nMax - 1, 0);
+#ifdef __REACTOS__ /* CORE-16466 part 1 of 4 */
+ horzInfo.nMax = (horzInfo.nPage == 0 ? 0 : horzInfo.nMax);
+#endif
dx = GetScrollPos(infoPtr->hwndSelf, SB_HORZ);
dx -= SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo, TRUE);
TRACE("horzInfo=%s\n", debugscrollinfo(&horzInfo));
@@ -2111,10 +2114,27 @@ static INT LISTVIEW_UpdateVScroll(LISTVIEW_INFO *infoPtr)
ZeroMemory(&vertInfo, sizeof(SCROLLINFO));
vertInfo.cbSize = sizeof(SCROLLINFO);
+#ifdef __REACTOS__ /* CORE-16466 part 2 of 4 */
+ vertInfo.nPage = max((infoPtr->rcList.bottom - infoPtr->rcList.top), 0);
+#else
vertInfo.nPage = infoPtr->rcList.bottom - infoPtr->rcList.top;
+#endif
if (infoPtr->uView == LV_VIEW_DETAILS)
{
+#ifdef __REACTOS__ /* CORE-16466 part 3 of 4 */
+ if (vertInfo.nPage != 0)
+ {
+ vertInfo.nMax = infoPtr->nItemCount;
+
+ /* scroll by at least one page */
+ if (vertInfo.nPage < infoPtr->nItemHeight)
+ vertInfo.nPage = infoPtr->nItemHeight;
+
+ if (infoPtr->nItemHeight > 0)
+ vertInfo.nPage /= infoPtr->nItemHeight;
+ }
+#else
vertInfo.nMax = infoPtr->nItemCount;
/* scroll by at least one page */
@@ -2123,6 +2143,7 @@ static INT LISTVIEW_UpdateVScroll(LISTVIEW_INFO *infoPtr)
if (infoPtr->nItemHeight > 0)
vertInfo.nPage /= infoPtr->nItemHeight;
+#endif
}
else if (infoPtr->uView != LV_VIEW_LIST) /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
{
@@ -2133,6 +2154,9 @@ static INT LISTVIEW_UpdateVScroll(LISTVIEW_INFO *infoPtr)
vertInfo.fMask = SIF_RANGE | SIF_PAGE;
vertInfo.nMax = max(vertInfo.nMax - 1, 0);
+#ifdef __REACTOS__ /* CORE-16466 part 4 of 4 */
+ vertInfo.nMax = (vertInfo.nPage == 0 ? 0 : vertInfo.nMax);
+#endif
dy = GetScrollPos(infoPtr->hwndSelf, SB_VERT);
dy -= SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &vertInfo, TRUE);
TRACE("vertInfo=%s\n", debugscrollinfo(&vertInfo));