https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ad57373701686876c604…
commit 5ad57373701686876c604f3bd58fbb2e449d5d81
Author: Joachim Henze <joachim.henze(a)reactos.org>
AuthorDate: Sun Feb 12 00:35:27 2023 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Feb 12 00:35:27 2023 +0100
[NTUSER] Delete temporary workarounds in co_IntSetScrollInfo() (#4985)
fixes JIRA issue: CORE-18050
improves the code by removing ancient hacks (the static variables)
reduces testbot failures
VBox:
https://reactos.org/testman/compare.php?ids=85831,85832 LGTM (-2 failures in
user32:scroll for both bots)
KVM:
https://reactos.org/testman/compare.php?ids=85829,85833 LGTM (-2 failures in
user32:scroll for both bots)
co-authored by Doug-Lyons
---
win32ss/user/ntuser/scrollbar.c | 60 +++++------------------------------------
1 file changed, 6 insertions(+), 54 deletions(-)
diff --git a/win32ss/user/ntuser/scrollbar.c b/win32ss/user/ntuser/scrollbar.c
index 3763ac5c494..e52b70a21da 100644
--- a/win32ss/user/ntuser/scrollbar.c
+++ b/win32ss/user/ntuser/scrollbar.c
@@ -488,20 +488,15 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL
bRedraw)
UINT new_flags;
INT action = 0;
PSBDATA pSBData;
- DWORD OldPos = 0, CurrentPos = 0;
+ DWORD OldPos = 0;
BOOL bChangeParams = FALSE; /* Don't show/hide scrollbar if params don't
change */
UINT MaxPage;
int MaxPos;
- /* [0] = SB_HORZ, [1] = SB_VERT, [2] = SB_CTL */
- static PWND PrevHwnd[3] = { 0 };
- static DWORD PrevPos[3] = { 0 };
- static DWORD PrevMax[3] = { 0 };
- static INT PrevAction[3] = { 0 };
BOOL bVisible;
ASSERT_REFS_CO(Window);
- if(!SBID_IS_VALID(nBar)) /* Assures nBar is 0, 1, or 2 */
+ if(!SBID_IS_VALID(nBar))
{
EngSetLastError(ERROR_INVALID_PARAMETER);
ERR("Trying to set scrollinfo for unknown scrollbar type %d\n", nBar);
@@ -548,9 +543,9 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL
bRedraw)
/* Set the scroll pos */
if (lpsi->fMask & SIF_POS)
{
+ OldPos = Info->nPos;
if (Info->nPos != lpsi->nPos)
{
- OldPos = Info->nPos;
Info->nPos = lpsi->nPos;
pSBData->pos = lpsi->nPos;
}
@@ -645,16 +640,6 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL
bRedraw)
}
//done:
- if ((Window != PrevHwnd[nBar]) || (action != PrevAction[nBar]))
- {
- if ((action == SA_SSI_SHOW) && (PrevAction[nBar] == SA_SSI_HIDE))
- {
- co_UserShowScrollBar(Window, nBar, TRUE, TRUE);
- }
- }
- if ((action != PrevAction[nBar]) && action != 0)
- PrevAction[nBar] = action;
-
if ( action & SA_SSI_HIDE )
{
co_UserShowScrollBar(Window, nBar, FALSE, FALSE);
@@ -685,7 +670,6 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL
bRedraw)
{
if (!(Info->fMask & SIF_THEMED)) /* Not Using Themes */
{
- TRACE("Not using themes.\n");
if (action & SA_SSI_REPAINT_ARROWS)
{
// Redraw the entire bar.
@@ -702,50 +686,18 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL
bRedraw)
IntRefeshScrollInterior(Window, nBar, psbi);
}
}
- else /* Using Themes */
+ else /* Using Themes */
{
RECTL UpdateRect = psbi->rcScrollBar;
- TRACE("Using themes.\n");
UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
- /* Just paint the interior and not the arrows. */
- if (!(action & SA_SSI_REPAINT_ARROWS))
- {
- if (nBar == SB_HORZ)
- {
- UpdateRect.left += psbi->dxyLineButton;
- UpdateRect.right -= psbi->dxyLineButton;
- }
- if (nBar == SB_VERT)
- {
- UpdateRect.top += psbi->dxyLineButton;
- UpdateRect.bottom -= psbi->dxyLineButton;
- }
- }
- CurrentPos = lpsi->fMask & SIF_PREVIOUSPOS ? OldPos :
pSBData->pos;
- /* Check for changes to Window or CurrentPos or lpsi->nMax */
- if ((Window != PrevHwnd[nBar]) || (CurrentPos != PrevPos[nBar]) ||
- (lpsi->nMax != PrevMax[nBar]))
- {
+ if (bChangeParams || (OldPos != pSBData->pos))
co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE |
RDW_FRAME);
- PrevHwnd[nBar] = Window;
- PrevPos[nBar] = CurrentPos;
- PrevMax[nBar] = lpsi->nMax;
- }
}
- } // FIXME: Arrows
-/* else if( action & SA_SSI_REPAINT_ARROWS )
- {
- RECTL UpdateRect = psbi->rcScrollBar;
- UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
- UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
- UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
- UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
- co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME);
}
-*/ }
+ }
if (bChangeParams && (nBar == SB_HORZ || nBar == SB_VERT) &&
(lpsi->fMask & SIF_DISABLENOSCROLL))
{