Author: tfaber
Date: Fri Apr 17 18:02:09 2015
New Revision: 67227
URL:
http://svn.reactos.org/svn/reactos?rev=67227&view=rev
Log:
[WIN32SS]
- Fix some scrollbar bugs as indicated by user32_apitest:SetScrollInfo
- Silence a trace
CORE-9553 #resolve
Modified:
trunk/reactos/win32ss/user/ntuser/scrollbar.c
trunk/reactos/win32ss/user/user32/controls/scrollbar.c
Modified: trunk/reactos/win32ss/user/ntuser/scrollbar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/scroll…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/scrollbar.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/scrollbar.c [iso-8859-1] Fri Apr 17 18:02:09 2015
@@ -347,6 +347,8 @@
PSBDATA pSBData;
DWORD OldPos = 0;
BOOL bChangeParams = FALSE; /* Don't show/hide scrollbar if params don't
change */
+ UINT MaxPage;
+ int MaxPos;
ASSERT_REFS_CO(Window);
@@ -404,14 +406,12 @@
/* Set the scroll range */
if (lpsi->fMask & SIF_RANGE)
{
- /* Invalid range -> range is set to (0,0) */
- if ((lpsi->nMin > lpsi->nMax) ||
- ((UINT)(lpsi->nMax - lpsi->nMin) >= 0x80000000))
+ if (lpsi->nMin > lpsi->nMax)
{
- Info->nMin = 0;
- Info->nMax = 0;
- pSBData->posMin = 0;
- pSBData->posMax = 0;
+ Info->nMin = lpsi->nMin;
+ Info->nMax = lpsi->nMin;
+ pSBData->posMin = lpsi->nMin;
+ pSBData->posMax = lpsi->nMin;
bChangeParams = TRUE;
}
else if (Info->nMin != lpsi->nMin || Info->nMax != lpsi->nMax)
@@ -425,23 +425,22 @@
}
/* Make sure the page size is valid */
- if (Info->nPage < 0)
- {
- pSBData->page = Info->nPage = 0;
- }
- else if ((Info->nMax - Info->nMin + 1UL) < Info->nPage)
- {
- pSBData->page = Info->nPage = Info->nMax - Info->nMin + 1;
+ MaxPage = abs(Info->nMax - Info->nMin) + 1;
+ if (Info->nPage > MaxPage)
+ {
+ pSBData->page = Info->nPage = MaxPage;
}
/* Make sure the pos is inside the range */
+ MaxPos = Info->nMax + 1 - (int)max(Info->nPage, 1);
+ ASSERT(MaxPos >= Info->nMin);
if (Info->nPos < Info->nMin)
{
pSBData->pos = Info->nPos = Info->nMin;
}
- else if (Info->nPos > (Info->nMax - max((int)Info->nPage - 1, 0)))
- {
- pSBData->pos = Info->nPos = Info->nMax - max(Info->nPage - 1, 0);
+ else if (Info->nPos > MaxPos)
+ {
+ pSBData->pos = Info->nPos = MaxPos;
}
/*
Modified: trunk/reactos/win32ss/user/user32/controls/scrollbar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/contro…
==============================================================================
--- trunk/reactos/win32ss/user/user32/controls/scrollbar.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/controls/scrollbar.c [iso-8859-1] Fri Apr 17
18:02:09 2015
@@ -1043,7 +1043,7 @@
Info.cbSize = sizeof(SCROLLINFO);
Info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
Info.nMin = 0;
- Info.nMax = 100;
+ Info.nMax = 0;
Info.nPage = 0;
Info.nPos = 0;
Info.nTrackPos = 0;
@@ -1189,7 +1189,7 @@
{
if (!pWnd->fnid)
{
- ERR("ScrollBar CTL size %d\n",(sizeof(SBWND)-sizeof(WND)));
+ TRACE("ScrollBar CTL size %d\n", (sizeof(SBWND)-sizeof(WND)));
if ( pWnd->cbwndExtra != (sizeof(SBWND)-sizeof(WND)) )
{
ERR("Wrong Extra bytes for Scrollbar!\n");