[WIN32SS]

- Fix some scrollbar bugs as indicated by user32_apitest:SetScrollInfo
- Silence a trace
CORE-9553 #resolve

svn path=/trunk/; revision=67227
This commit is contained in:
Thomas Faber 2015-04-17 18:02:09 +00:00
parent 2829ed5afe
commit d9c9bf096c
2 changed files with 16 additions and 17 deletions

View file

@ -347,6 +347,8 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
PSBDATA pSBData; PSBDATA pSBData;
DWORD OldPos = 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;
int MaxPos;
ASSERT_REFS_CO(Window); ASSERT_REFS_CO(Window);
@ -404,14 +406,12 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
/* Set the scroll range */ /* Set the scroll range */
if (lpsi->fMask & SIF_RANGE) if (lpsi->fMask & SIF_RANGE)
{ {
/* Invalid range -> range is set to (0,0) */ if (lpsi->nMin > lpsi->nMax)
if ((lpsi->nMin > lpsi->nMax) ||
((UINT)(lpsi->nMax - lpsi->nMin) >= 0x80000000))
{ {
Info->nMin = 0; Info->nMin = lpsi->nMin;
Info->nMax = 0; Info->nMax = lpsi->nMin;
pSBData->posMin = 0; pSBData->posMin = lpsi->nMin;
pSBData->posMax = 0; pSBData->posMax = lpsi->nMin;
bChangeParams = TRUE; bChangeParams = TRUE;
} }
else if (Info->nMin != lpsi->nMin || Info->nMax != lpsi->nMax) else if (Info->nMin != lpsi->nMin || Info->nMax != lpsi->nMax)
@ -425,23 +425,22 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
} }
/* Make sure the page size is valid */ /* Make sure the page size is valid */
if (Info->nPage < 0) MaxPage = abs(Info->nMax - Info->nMin) + 1;
if (Info->nPage > MaxPage)
{ {
pSBData->page = Info->nPage = 0; pSBData->page = Info->nPage = MaxPage;
}
else if ((Info->nMax - Info->nMin + 1UL) < Info->nPage)
{
pSBData->page = Info->nPage = Info->nMax - Info->nMin + 1;
} }
/* Make sure the pos is inside the range */ /* 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) if (Info->nPos < Info->nMin)
{ {
pSBData->pos = Info->nPos = Info->nMin; pSBData->pos = Info->nPos = Info->nMin;
} }
else if (Info->nPos > (Info->nMax - max((int)Info->nPage - 1, 0))) else if (Info->nPos > MaxPos)
{ {
pSBData->pos = Info->nPos = Info->nMax - max(Info->nPage - 1, 0); pSBData->pos = Info->nPos = MaxPos;
} }
/* /*

View file

@ -1043,7 +1043,7 @@ static void IntScrollCreateScrollBar(
Info.cbSize = sizeof(SCROLLINFO); Info.cbSize = sizeof(SCROLLINFO);
Info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; Info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
Info.nMin = 0; Info.nMin = 0;
Info.nMax = 100; Info.nMax = 0;
Info.nPage = 0; Info.nPage = 0;
Info.nPos = 0; Info.nPos = 0;
Info.nTrackPos = 0; Info.nTrackPos = 0;
@ -1189,7 +1189,7 @@ ScrollBarWndProc_common(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam
{ {
if (!pWnd->fnid) 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)) ) if ( pWnd->cbwndExtra != (sizeof(SBWND)-sizeof(WND)) )
{ {
ERR("Wrong Extra bytes for Scrollbar!\n"); ERR("Wrong Extra bytes for Scrollbar!\n");