X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;ds=sidebyside;f=dmenu.c;h=f105b5679d38cb0d10f2239f3a4836076662af5f;hb=4126b1e32379ee206c5c9bda2bf3699f171c9899;hp=9d479f9be982563d948ac3b6473f85df7a54a800;hpb=50207344084b385839cef251f77f5129dc85874e;p=dmenu.git diff --git a/dmenu.c b/dmenu.c index 9d479f9..f105b56 100644 --- a/dmenu.c +++ b/dmenu.c @@ -454,6 +454,7 @@ readstdin(void) { if(items) items[i].text = NULL; inputw = maxstr ? textw(dc, maxstr) : 0; + lines = MIN(lines, i); } void @@ -509,8 +510,8 @@ setup(void) { XWindowAttributes wa; XGetInputFocus(dc->dpy, &w, &di); - if(w != root && XGetWindowAttributes(dc->dpy, w, &wa)) - XTranslateCoordinates(dc->dpy, root, root, wa.x, wa.y, &x, &y, &dw); + if(w != root && w != PointerRoot && w != None && XGetWindowAttributes(dc->dpy, w, &wa)) + XTranslateCoordinates(dc->dpy, w, root, wa.x, wa.y, &x, &y, &dw); else XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du); for(i = 0; i < n-1; i++)