mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[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
This commit is contained in:
parent
a38d19ebce
commit
5ad5737370
1 changed files with 6 additions and 54 deletions
|
@ -488,20 +488,15 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||||
UINT new_flags;
|
UINT new_flags;
|
||||||
INT action = 0;
|
INT action = 0;
|
||||||
PSBDATA pSBData;
|
PSBDATA pSBData;
|
||||||
DWORD OldPos = 0, CurrentPos = 0;
|
DWORD OldPos = 0;
|
||||||
BOOL bChangeParams = FALSE; /* Don't show/hide scrollbar if params don't change */
|
BOOL bChangeParams = FALSE; /* Don't show/hide scrollbar if params don't change */
|
||||||
UINT MaxPage;
|
UINT MaxPage;
|
||||||
int MaxPos;
|
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;
|
BOOL bVisible;
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
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);
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
ERR("Trying to set scrollinfo for unknown scrollbar type %d\n", nBar);
|
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 */
|
/* Set the scroll pos */
|
||||||
if (lpsi->fMask & SIF_POS)
|
if (lpsi->fMask & SIF_POS)
|
||||||
{
|
{
|
||||||
|
OldPos = Info->nPos;
|
||||||
if (Info->nPos != lpsi->nPos)
|
if (Info->nPos != lpsi->nPos)
|
||||||
{
|
{
|
||||||
OldPos = Info->nPos;
|
|
||||||
Info->nPos = lpsi->nPos;
|
Info->nPos = lpsi->nPos;
|
||||||
pSBData->pos = lpsi->nPos;
|
pSBData->pos = lpsi->nPos;
|
||||||
}
|
}
|
||||||
|
@ -645,16 +640,6 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||||
}
|
}
|
||||||
|
|
||||||
//done:
|
//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 )
|
if ( action & SA_SSI_HIDE )
|
||||||
{
|
{
|
||||||
co_UserShowScrollBar(Window, nBar, FALSE, FALSE);
|
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 */
|
if (!(Info->fMask & SIF_THEMED)) /* Not Using Themes */
|
||||||
{
|
{
|
||||||
TRACE("Not using themes.\n");
|
|
||||||
if (action & SA_SSI_REPAINT_ARROWS)
|
if (action & SA_SSI_REPAINT_ARROWS)
|
||||||
{
|
{
|
||||||
// Redraw the entire bar.
|
// Redraw the entire bar.
|
||||||
|
@ -702,50 +686,18 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
|
||||||
IntRefeshScrollInterior(Window, nBar, psbi);
|
IntRefeshScrollInterior(Window, nBar, psbi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Using Themes */
|
else /* Using Themes */
|
||||||
{
|
{
|
||||||
RECTL UpdateRect = psbi->rcScrollBar;
|
RECTL UpdateRect = psbi->rcScrollBar;
|
||||||
TRACE("Using themes.\n");
|
|
||||||
UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
|
UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
|
||||||
UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
|
UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
|
||||||
UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
|
UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
|
||||||
UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
|
UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
|
||||||
/* Just paint the interior and not the arrows. */
|
if (bChangeParams || (OldPos != pSBData->pos))
|
||||||
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]))
|
|
||||||
{
|
|
||||||
co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME);
|
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))
|
if (bChangeParams && (nBar == SB_HORZ || nBar == SB_VERT) && (lpsi->fMask & SIF_DISABLENOSCROLL))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue