user32: Use SIF_RETURNPREV for SetScrollPos implementation.

This commit is contained in:
Jacek Caban 2022-07-03 23:34:38 +02:00 committed by Alexandre Julliard
parent c9c69dff7e
commit 9d3058aa3a
2 changed files with 4 additions and 10 deletions

View file

@ -518,18 +518,14 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetScrollInfo(HWND hwnd, INT nBar, LPSCROLLINFO in
* Note the ambiguity when 0 is returned. Use GetLastError
* to make sure there was an error (and to know which one).
*/
INT WINAPI DECLSPEC_HOTPATCH SetScrollPos( HWND hwnd, INT nBar, INT nPos, BOOL bRedraw)
int WINAPI DECLSPEC_HOTPATCH SetScrollPos( HWND hwnd, int bar, int pos, BOOL redraw )
{
SCROLLINFO info;
SCROLLBAR_INFO *infoPtr;
INT oldPos = 0;
if ((infoPtr = SCROLL_GetInternalInfo( hwnd, nBar, FALSE ))) oldPos = infoPtr->curVal;
info.cbSize = sizeof(info);
info.nPos = nPos;
info.fMask = SIF_POS;
NtUserSetScrollInfo( hwnd, nBar, &info, bRedraw );
return oldPos;
info.nPos = pos;
info.fMask = SIF_POS | SIF_RETURNPREV;
return NtUserSetScrollInfo( hwnd, bar, &info, redraw );
}

View file

@ -738,7 +738,6 @@ static void test_subclass(void)
res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
ok(res == 2, "SetScrollPos returned %Iu\n", res);
ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
todo_wine
ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
ok(set_scrollinfo.nPos == 1, "nPos = %x\n", set_scrollinfo.nPos);
@ -780,7 +779,6 @@ static void test_subclass(void)
res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
ok(res == 0, "SetScrollPos returned %Iu\n", res);
ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
todo_wine
ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
ok(set_scrollinfo.nPos == 1, "nPos = %x\n", set_scrollinfo.nPos);