pinentry-dmenu

a pinentry program based on dmenu
git clone anongit@rnpnr.xyz:pinentry-dmenu.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 9e606e1db8e81781c2a9a6deb8d92e7a9b9ca1f9
Parent: 8e0ff2e390159d7cb6fb093f4eed88a949a7b6aa
Author: Hiltjo Posthuma
Date:   Tue,  1 Mar 2022 22:45:39 +0100

remove false-positive warning for int comparison as bool

Reported by Prathu Baronia <prathu.baronia@praton.me>, patch slightly changed.

Thanks!

Diffstat:
Mpinentry-dmenu.c | 15+++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/pinentry-dmenu.c b/pinentry-dmenu.c @@ -26,9 +26,8 @@ #define CONFIG_DIR "/.gnupg" #define CONFIG_FILE "/pinentry-dmenu.conf" -#define INTERSECT(x, y, w, h, r) \ - (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \ - && MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org))) +#define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \ + * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org))) #define LENGTH(X) (sizeof(X) / sizeof(X[0])) #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) #define MINDESCLEN 8 @@ -319,14 +318,10 @@ 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 (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]) != 0) break; - } - } - } x = info[i].x_org; y = info[i].y_org + (bottom ? info[i].height - mh : 0);