https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3bf7e3ac13c5c9df373827c102b763b5b9822204

commit 3bf7e3ac13c5c9df373827c102b763b5b9822204
Author:     Doug Lyons <[email protected]>
AuthorDate: Sun Sep 12 15:54:46 2021 -0500
Commit:     GitHub <[email protected]>
CommitDate: Sun Sep 12 22:54:46 2021 +0200

    [NTUSER] Improve Themed Scrollbars by Minimizing Updates (#3953)
    
    
    This fixes regressions CORE-17754 and CORE-17755 which regressed by
    0.4.15-dev-3086-g 236649c626f97c68a9d0a6709a1bb342681b2aa0
---
 win32ss/user/ntuser/scrollbar.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/win32ss/user/ntuser/scrollbar.c b/win32ss/user/ntuser/scrollbar.c
index 359bc923f5b..52d5f38c377 100644
--- a/win32ss/user/ntuser/scrollbar.c
+++ b/win32ss/user/ntuser/scrollbar.c
@@ -488,10 +488,13 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO 
lpsi, BOOL bRedraw)
    UINT new_flags;
    INT action = 0;
    PSBDATA pSBData;
-   DWORD OldPos = 0;
+   DWORD OldPos = 0, CurrentPos = 0;
    BOOL bChangeParams = FALSE; /* Don't show/hide scrollbar if params don't 
change */
    UINT MaxPage;
    int MaxPos;
+   /* [0] = HORZ, [1] = VERT */
+   static PWND PrevHwnd[2] = { 0 };
+   static DWORD PrevPos[2] = { 0 };
 
    ASSERT_REFS_CO(Window);
 
@@ -686,7 +689,14 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO 
lpsi, BOOL bRedraw)
                   UpdateRect.bottom -= psbi->dxyLineButton;
                }
             }
-            co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | 
RDW_FRAME);
+            CurrentPos = lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos;
+            /* Check for changes to Window or CurrentPos */
+            if ((Window != PrevHwnd[nBar]) || (CurrentPos != PrevPos[nBar]))
+            {
+                co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | 
RDW_FRAME);
+                PrevHwnd[nBar] = Window;
+                PrevPos[nBar] = CurrentPos;
+            }
          }
       } // FIXME: Arrows
 /*      else if( action & SA_SSI_REPAINT_ARROWS )

Reply via email to