On Fri, Feb 25, 2022 at 11:07:49AM +0530, Prathu Baronia wrote:
> - Compare the result of the macro with 0 instead of treating as bool to remove
>   the following warning.
> 
> dmenu.c: In function ‘setup’:
> dmenu.c:24:30: warning: ‘*’ in boolean context, suggest ‘&&’ instead 
> [-Wint-in-bool-context]
>    23 | #define INTERSECT(x,y,w,h,r)  (MAX(0, 
> MIN((x)+(w),(r).x_org+(r).width)  - MAX((x),(r).x_org)) \
>       |                               
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    24 |                              * MAX(0, 
> MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
>       |                              
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> dmenu.c:655:37: note: in expansion of macro ‘INTERSECT’
>   655 |                                 if (INTERSECT(x, y, 1, 1, info[i]))
>       |                                     ^~~~~~~~~
> 
> Signed-off-by: Prathu Baronia <prathu.baro...@praton.me>
> ---
>  dmenu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/dmenu.c b/dmenu.c
> index d95e6c6..81b8567 100644
> --- a/dmenu.c
> +++ b/dmenu.c
> @@ -652,7 +652,7 @@ setup(void)
>               /* no focused window is on screen, so use pointer location 
> instead */
>               if (mon < 0 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, 
> &y, &di, &di, &du))
>                       for (i = 0; i < n; i++)
> -                             if (INTERSECT(x, y, 1, 1, info[i]))
> +                             if (INTERSECT(x, y, 1, 1, info[i]) > 0)
>                                       break;
>  
>               x = info[i].x_org;
> -- 
> 2.35.1
> 
> 

Hi Prathu,

I slightly changed the patch to != 0 and pushed it, thanks!

-- 
Kind regards,
Hiltjo

Reply via email to