[PATCH 2/2] include: Use inline functions for common RECT helpers.

Michael Stefaniuc mstefani at redhat.de
Sun May 15 19:49:34 CDT 2016


Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
---
 dlls/user32/tests/uitools.c |  1 +
 dlls/user32/uitools.c       |  1 +
 include/winuser.h           | 38 +++++++++++++++++++++++++++++++++++---
 3 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/tests/uitools.c b/dlls/user32/tests/uitools.c
index e1ddf2b..1be709c 100644
--- a/dlls/user32/tests/uitools.c
+++ b/dlls/user32/tests/uitools.c
@@ -17,6 +17,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define WINE_NO_INLINE_RECT
 #include "wine/test.h"
 #include "winbase.h"
 #include "wingdi.h"
diff --git a/dlls/user32/uitools.c b/dlls/user32/uitools.c
index 68c3c8e..efaf356 100644
--- a/dlls/user32/uitools.c
+++ b/dlls/user32/uitools.c
@@ -21,6 +21,7 @@
 
 #include <stdarg.h>
 
+#define WINE_NO_INLINE_RECT
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
diff --git a/include/winuser.h b/include/winuser.h
index 0c527fb..2b56a0c 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -3771,7 +3771,6 @@ WINUSERAPI BOOL        WINAPI IsGUIThread(BOOL);
 WINUSERAPI BOOL        WINAPI IsHungAppWindow(HWND);
 WINUSERAPI BOOL        WINAPI IsIconic(HWND);
 WINUSERAPI BOOL        WINAPI IsMenu(HMENU);
-WINUSERAPI BOOL        WINAPI IsRectEmpty(const RECT*);
 WINUSERAPI BOOL        WINAPI IsTouchWindow(HWND,PULONG);
 WINUSERAPI BOOL        WINAPI IsWinEventHookInstalled(DWORD);
 WINUSERAPI BOOL        WINAPI IsWindow(HWND);
@@ -3982,8 +3981,6 @@ WINUSERAPI HWND        WINAPI SetParent(HWND,HWND);
 WINUSERAPI BOOL        WINAPI SetPropA(HWND,LPCSTR,HANDLE);
 WINUSERAPI BOOL        WINAPI SetPropW(HWND,LPCWSTR,HANDLE);
 #define                       SetProp WINELIB_NAME_AW(SetProp)
-WINUSERAPI BOOL        WINAPI SetRect(LPRECT,INT,INT,INT,INT);
-WINUSERAPI BOOL        WINAPI SetRectEmpty(LPRECT);
 WINUSERAPI INT         WINAPI SetScrollInfo(HWND,INT,const SCROLLINFO*,BOOL);
 WINUSERAPI INT         WINAPI SetScrollPos(HWND,INT,INT,BOOL);
 WINUSERAPI BOOL        WINAPI SetScrollRange(HWND,INT,INT,INT,BOOL);
@@ -4092,6 +4089,41 @@ WINUSERAPI INT         WINAPI wvsprintfA(LPSTR,LPCSTR,__ms_va_list);
 WINUSERAPI INT         WINAPI wvsprintfW(LPWSTR,LPCWSTR,__ms_va_list);
 #define                       wvsprintf WINELIB_NAME_AW(wvsprintf)
 
+#if !defined(__WINESRC__) || defined(WINE_NO_INLINE_RECT)
+
+WINUSERAPI BOOL        WINAPI IsRectEmpty(const RECT*);
+WINUSERAPI BOOL        WINAPI SetRect(LPRECT,INT,INT,INT,INT);
+WINUSERAPI BOOL        WINAPI SetRectEmpty(LPRECT);
+
+#else
+
+/* Inline versions of common RECT helpers */
+
+static inline BOOL WINAPI IsRectEmpty(const RECT *rect)
+{
+    if (!rect) return TRUE;
+    return ((rect->left >= rect->right) || (rect->top >= rect->bottom));
+}
+
+static inline BOOL WINAPI SetRect(LPRECT rect, INT left, INT top, INT right, INT bottom)
+{
+    if (!rect) return FALSE;
+    rect->left   = left;
+    rect->right  = right;
+    rect->top    = top;
+    rect->bottom = bottom;
+    return TRUE;
+}
+
+static inline BOOL WINAPI SetRectEmpty(LPRECT rect)
+{
+    if (!rect) return FALSE;
+    rect->left = rect->right = rect->top = rect->bottom = 0;
+    return TRUE;
+}
+
+#endif /* !defined(__WINESRC__) || defined(WINE_NO_INLINE_RECT) */
+
 /* Undocumented functions */
 
 /* NOTE: This is SYSTEM.3, not USER.182, which is also named KillSystemTimer */
-- 
2.4.11



More information about the wine-patches mailing list