winemac.drv: Use IsRectEmpty() instead of open coding it.

Ken Thomases ken at codeweavers.com
Wed May 4 02:46:16 CDT 2016


On May 3, 2016, at 2:47 PM, Michael Stefaniuc <mstefani at redhat.de> wrote:
> 
> Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
> ---
> Not even compile tested. But as this is a purely generated patch there
> was no opportunity for me to screw it up...

In fact, it doesn't compile. :-/

You've added a call to IsRectEmpty() to macdrv.h, which doesn't #include winuser.h.  That alone only causes an implicit declaration warning.  However, clipboard.c includes winuser.h after macdrv.h, which causes an error about the conflict between the real and implicit declarations.

You can move the include of winuser.h from all of the modules to macdrv.h, but make sure to #define OEMRESOURCE before it, as required by mouse.c.  It also seems to need to come after the include of wingdi.h.

-Ken

> 
> 
> 
> dlls/winemac.drv/macdrv.h | 2 +-
> dlls/winemac.drv/window.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h
> index f3b5e65..81b642c 100644
> --- a/dlls/winemac.drv/macdrv.h
> +++ b/dlls/winemac.drv/macdrv.h
> @@ -47,7 +47,7 @@
> 
> static inline CGRect cgrect_from_rect(RECT rect)
> {
> -    if (rect.left >= rect.right || rect.top >= rect.bottom)
> +    if (IsRectEmpty(&rect))
>         return CGRectMake(rect.left, rect.top, 0, 0);
>     return CGRectMake(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
> }
> diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
> index a48ac17..fbea49f 100644
> --- a/dlls/winemac.drv/window.c
> +++ b/dlls/winemac.drv/window.c
> @@ -401,7 +401,7 @@ static void sync_window_region(struct macdrv_win_data *data, HRGN win_region)
>  */
> static inline void add_bounds_rect(RECT *bounds, const RECT *rect)
> {
> -    if (rect->left >= rect->right || rect->top >= rect->bottom) return;
> +    if (IsRectEmpty(rect)) return;
>     bounds->left   = min(bounds->left, rect->left);
>     bounds->top    = min(bounds->top, rect->top);
>     bounds->right  = max(bounds->right, rect->right);
> -- 
> 2.4.11
> 
> 




More information about the wine-devel mailing list