Add messaging for SB_CTL bars to scroll.c

Andrew Johnston johnstonam at logica.com
Thu Mar 6 01:38:07 CST 2003


On Thursday 06 March 2003 11:49, Dimitrie O. Paun wrote:
> Please use inline functions for this sort of thing.
> Also, it's typically better to ask the positive question:

This patch when applied to the previous patch makes the requested change.

Changelog:
    Remove Macro for detecting invalid SCROLLINFO structures and
    make it an inline function    

License: X11

Andrew

--- controls/scroll.c	2003-03-06 15:06:59.000000000 +0800
+++ controls/scroll.c	2003-03-06 15:02:12.000000000 +0800
@@ -81,12 +81,6 @@
   /* Scroll timer id */
 #define SCROLL_TIMER   0
 
-/* Determine if the info is valid */
-#define SCROLL_INFO_INVALID(info) \
-    ((info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) || \
-    ((info->cbSize != sizeof(*info)) && \
-    (info->cbSize != sizeof(*info) - sizeof(info->nTrackPos))))
-
   /* Scroll-bar hit testing */
 enum SCROLL_HITTEST
 {
@@ -142,6 +136,19 @@
     IDC_ARROWA,             /* cursor */
     0                       /* brush */
 };
+    
+/***********************************************************************
+ *           SCROLL_ScrollInfoValid
+ *
+ *  Determine if the supplied SCROLLINFO struct is valid.
+ */
+inline static BOOL SCROLL_ScrollInfoValid(
+LPSCROLLINFO info /* [in] The SCROLLINFO struct to be tested */)
+{
+    return !(info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)
+        || (info->cbSize != sizeof(*info)
+            && info->cbSize != sizeof(*info) - sizeof(info->nTrackPos)));
+}
 
 
 /***********************************************************************
@@ -1211,8 +1218,8 @@
     LPSCROLLBAR_INFO infoPtr;
 
     /* handle invalid data structure */
-    if (SCROLL_INFO_INVALID(info)
-        || (!(infoPtr = SCROLL_GetScrollBarInfo(hwnd, nBar))))
+    if (!(SCROLL_ScrollInfoValid(info)
+        && (infoPtr = SCROLL_GetScrollBarInfo(hwnd, nBar))))
             return FALSE;
 
     /* fill in the desired scroll info structure */




More information about the wine-devel mailing list