win32ss/user/user32/controls/scrollbar.c | 52 ++++++++++++++++++++++++++------ win32ss/user/ntuser/scrollbar.c | 7 +++++-- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/win32ss/user/user32/controls/scrollbar.c b/win32ss/user/user32/controls/scrollbar.c index 1e1249e296..c9002d14b4 100644 --- a/win32ss/user/user32/controls/scrollbar.c +++ b/win32ss/user/user32/controls/scrollbar.c @@ -318,6 +318,26 @@ IntGetScrollBarInfo(HWND Wnd, INT Bar, PSCROLLBARINFO ScrollBarInfo) return NtUserGetScrollBarInfo(Wnd, IntScrollGetObjectId(Bar), ScrollBarInfo); } +static VOID FASTCALL +IntUpdateScrollArrows(HWND Wnd, HDC hDC, PSCROLLBARINFO ScrollBarInfo, + SETSCROLLBARINFO *info, INT SBType, INT Arrow, + BOOL Vertical, BOOL Pressed) +{ + if (Pressed) + { + ScrollBarInfo->rgstate[Arrow] |= STATE_SYSTEM_PRESSED; + } + else + { + ScrollBarInfo->rgstate[Arrow] &= ~STATE_SYSTEM_PRESSED; + } + /* Update arrow state */ + info->rgstate[Arrow] = ScrollBarInfo->rgstate[Arrow]; + NtUserSetScrollBarInfo(Wnd, IntScrollGetObjectId(SBType), info); + + IntDrawScrollArrows(hDC, ScrollBarInfo, Vertical); +} + void IntDrawScrollBar(HWND Wnd, HDC DC, INT Bar) { @@ -834,9 +854,7 @@ IntScrollHandleScrollEvent(HWND Wnd, INT SBType, UINT Msg, POINT Pt) /* Don't update scrollbar if disabled. */ if (ScrollBarInfo.rgstate[ScrollTrackHitTest] != STATE_SYSTEM_UNAVAILABLE) { - ScrollBarInfo.rgstate[ScrollTrackHitTest] |= STATE_SYSTEM_PRESSED; - NewInfo.rgstate[ScrollTrackHitTest] = ScrollBarInfo.rgstate[ScrollTrackHitTest]; - NtUserSetScrollBarInfo(Wnd, IntScrollGetObjectId(SBType), &NewInfo); + IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, TRUE); } break; @@ -853,12 +871,8 @@ IntScrollHandleScrollEvent(HWND Wnd, INT SBType, UINT Msg, POINT Pt) /* Don't update scrollbar if disabled. */ if (ScrollBarInfo.rgstate[ScrollTrackHitTest] != STATE_SYSTEM_UNAVAILABLE) { - ScrollBarInfo.rgstate[ScrollTrackHitTest] &= ~STATE_SYSTEM_PRESSED; - NewInfo.rgstate[ScrollTrackHitTest] = ScrollBarInfo.rgstate[ScrollTrackHitTest]; - NtUserSetScrollBarInfo(Wnd, IntScrollGetObjectId(SBType), &NewInfo); - + IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, FALSE); IntDrawScrollInterior(Wnd,Dc,SBType,Vertical,&ScrollBarInfo); - IntDrawScrollArrows(Dc, &ScrollBarInfo, Vertical); } break; @@ -890,9 +904,17 @@ IntScrollHandleScrollEvent(HWND Wnd, INT SBType, UINT Msg, POINT Pt) SetSystemTimer(Wnd, SCROLL_TIMER, (WM_LBUTTONDOWN == Msg) ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, (TIMERPROC) NULL); + if (ScrollBarInfo.rgstate[ScrollTrackHitTest] != STATE_SYSTEM_UNAVAILABLE) + { + if (!(ScrollBarInfo.rgstate[ScrollTrackHitTest] &= STATE_SYSTEM_PRESSED)) + { + IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, TRUE); + } + } } else { + IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, FALSE); KillSystemTimer(Wnd, SCROLL_TIMER); } break; @@ -992,8 +1014,20 @@ IntScrollHandleScrollEvent(HWND Wnd, INT SBType, UINT Msg, POINT Pt) SetSystemTimer(Wnd, SCROLL_TIMER, (WM_LBUTTONDOWN == Msg) ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, (TIMERPROC) NULL); + if (ScrollBarInfo.rgstate[ScrollTrackHitTest] != STATE_SYSTEM_UNAVAILABLE) + { + if (!(ScrollBarInfo.rgstate[ScrollTrackHitTest] &= STATE_SYSTEM_PRESSED)) + { + TRACE("Set Arrow\n"); + IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, TRUE); + } + } } - else KillSystemTimer(Wnd, SCROLL_TIMER); + else + { + IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, FALSE); + KillSystemTimer(Wnd, SCROLL_TIMER); + } break; } diff --git a/win32ss/user/ntuser/scrollbar.c b/win32ss/user/ntuser/scrollbar.c index 6bbc7ae7bc..ece40873a4 100644 --- a/win32ss/user/ntuser/scrollbar.c +++ b/win32ss/user/ntuser/scrollbar.c @@ -540,7 +540,6 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw) OldPos = Info->nPos; Info->nPos = lpsi->nPos; pSBData->pos = lpsi->nPos; - bChangeParams = TRUE; } } @@ -614,11 +613,15 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw) else /* Show and enable scroll-bar only if no page only changed. */ if (lpsi->fMask != SIF_PAGE) { - new_flags = ESB_ENABLE_BOTH; if ((nBar != SB_CTL) && bChangeParams) { + new_flags = ESB_ENABLE_BOTH; action |= SA_SSI_SHOW; } + else if (nBar == SB_CTL) + { + new_flags = ESB_ENABLE_BOTH; + } } if (Window->pSBInfo->WSBflags != new_flags) /* Check arrow flags */