From 5f494bfeb4df0ccec6f7853860de24b2eeab0670 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Mon, 16 May 2016 02:49:34 +0200 Subject: [PATCH] include: Use inline functions for common RECT helpers. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- 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 e1ddf2b685d..1be709c8731 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 68c3c8e7bd6..efaf356bc21 100644 --- a/dlls/user32/uitools.c +++ b/dlls/user32/uitools.c @@ -21,6 +21,7 @@ #include +#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 0c527fb1ec4..2b56a0c9940 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 */