[PATCH v2 2/7] user32: Use SIF_RETURNPREV for SetScrollPos implementation.

Jacek Caban wine at gitlab.winehq.org
Tue Jul 5 02:08:32 CDT 2022


From: Jacek Caban <jacek at codeweavers.com>

---
 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);
 
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/374



More information about the wine-devel mailing list