Clean-up of scroll.c (1/4)
Andrew Johnston
johnstonam at logica.com
Tue Mar 4 21:10:48 CST 2003
On Wednesday 05 March 2003 01:17, Alexandre Julliard wrote:
> No, the message handling has to be changed too of course. Instead of
> having the message handler call the API function it has to be done the
> other way around, with the API function sending a message and the
> handler doing the work by accessing the info structure directly.
Something like this?
Andrew
Index: controls/scroll.c
===================================================================
RCS file: /home/wine/wine/controls/scroll.c,v
retrieving revision 1.62
diff -u -r1.62 scroll.c
--- controls/scroll.c 14 Jan 2003 23:41:01 -0000 1.62
+++ controls/scroll.c 5 Mar 2003 02:24:05 -0000
@@ -1192,6 +1192,27 @@
}
+/*************************************************************************
+ * SCROLL_GetScrollRange
+ *
+ * Internal worker function for the API function
+ *
+ * RETURNS STD
+ */
+static BOOL SCROLL_GetScrollRange(
+HWND hwnd, /* [in] Handle of window */
+INT nBar, /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */
+LPINT lpMin, /* [out] Where to store minimum value */
+LPINT lpMax /* [out] Where to store maximum value */)
+{
+ SCROLLBAR_INFO *infoPtr = SCROLL_GetScrollInfo(hwnd, nBar);
+
+ if (lpMin) *lpMin = infoPtr ? infoPtr->minVal : 0;
+ if (lpMax) *lpMax = infoPtr ? infoPtr->maxVal : 0;
+
+ return infoPtr ? TRUE : FALSE;
+}
+
/***********************************************************************
* ScrollBarWndProc
*/
@@ -1367,7 +1388,7 @@
return 0;
case SBM_GETRANGE:
- GetScrollRange( hwnd, SB_CTL, (LPINT)wParam, (LPINT)lParam );
+ SCROLL_GetScrollRange( hwnd, SB_CTL, (LPINT)wParam, (LPINT)lParam );
return 0;
case SBM_ENABLE_ARROWS16:
@@ -1741,17 +1762,11 @@
LPINT lpMin, /* [out] Where to store minimum value */
LPINT lpMax /* [out] Where to store maximum value */)
{
- SCROLLBAR_INFO *infoPtr;
-
- if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar )))
- {
- if (lpMin) lpMin = 0;
- if (lpMax) lpMax = 0;
- return FALSE;
- }
- if (lpMin) *lpMin = infoPtr->minVal;
- if (lpMax) *lpMax = infoPtr->maxVal;
- return TRUE;
+ /* Refer SB_CTL requests to the window */
+ if (nBar == SB_CTL)
+ return SendMessageA(hwnd, SBM_GETRANGE, (WPARAM)lpMin, (LPARAM)lpMax);
+ else
+ return SCROLL_GetScrollRange(hwnd, nBar, lpMin, lpMax);
}
More information about the wine-devel
mailing list