Jacek Caban : user32: Use GetScrollInfo for GetScrollPos implementation.
Alexandre Julliard
julliard at winehq.org
Tue Jul 5 15:55:06 CDT 2022
Module: wine
Branch: master
Commit: 67630d0f4c2c5b24f9219f9787bf93efeeec32d6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=67630d0f4c2c5b24f9219f9787bf93efeeec32d6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Jul 3 23:44:35 2022 +0200
user32: Use GetScrollInfo for GetScrollPos implementation.
---
dlls/user32/scroll.c | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index 8eb4b1d23ff..566bf9ecb21 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -311,22 +311,6 @@ void WINAPI USER_ScrollBarDraw( HWND hwnd, HDC hdc, INT nBar, enum SCROLL_HITTES
}
}
-/*************************************************************************
- * SCROLL_GetScrollPos
- *
- * Internal helper for the API function
- *
- * PARAMS
- * hwnd [I] Handle of window with scrollbar(s)
- * nBar [I] One of SB_HORZ, SB_VERT, or SB_CTL
- */
-static INT SCROLL_GetScrollPos(HWND hwnd, INT nBar)
-{
- LPSCROLLBAR_INFO infoPtr = SCROLL_GetInternalInfo(hwnd, nBar, FALSE);
- return infoPtr ? infoPtr->curVal: 0;
-}
-
-
/*************************************************************************
* SCROLL_GetScrollRange
*
@@ -483,15 +467,19 @@ int WINAPI DECLSPEC_HOTPATCH SetScrollPos( HWND hwnd, int bar, int pos, BOOL red
* There is ambiguity when 0 is returned. Use GetLastError
* to make sure there was an error (and to know which one).
*/
-INT WINAPI DECLSPEC_HOTPATCH GetScrollPos(HWND hwnd, INT nBar)
+int WINAPI DECLSPEC_HOTPATCH GetScrollPos( HWND hwnd, int bar )
{
- TRACE("hwnd=%p nBar=%d\n", hwnd, nBar);
+ SCROLLINFO info;
+
+ TRACE( "hwnd=%p bar=%d\n", hwnd, bar );
/* Refer SB_CTL requests to the window */
- if (nBar == SB_CTL)
- return SendMessageW(hwnd, SBM_GETPOS, 0, 0);
- else
- return SCROLL_GetScrollPos(hwnd, nBar);
+ if (bar == SB_CTL)
+ return SendMessageW( hwnd, SBM_GETPOS, 0, 0 );
+
+ info.cbSize = sizeof(info);
+ info.fMask = SIF_POS;
+ return GetScrollInfo( hwnd, bar, &info ) ? info.nPos : 0;
}
More information about the wine-cvs
mailing list