Jacek Caban : user32: Use SIF_RETURNPREV for SetScrollPos implementation.
Alexandre Julliard
julliard at winehq.org
Tue Jul 5 15:55:06 CDT 2022
Module: wine
Branch: master
Commit: 9d3058aa3a7ff9e86d6f78007b2e727110848284
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9d3058aa3a7ff9e86d6f78007b2e727110848284
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Jul 3 23:34:38 2022 +0200
user32: Use SIF_RETURNPREV for SetScrollPos implementation.
---
dlls/user32/scroll.c | 12 ++++--------
dlls/user32/tests/scroll.c | 2 --
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index e368a2feb70..c92ec6459d9 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -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 );
}
diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c
index 95782a47a6e..481219665ec 100644
--- a/dlls/user32/tests/scroll.c
+++ b/dlls/user32/tests/scroll.c
@@ -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);
More information about the wine-cvs
mailing list