fix crash if negative monitor (< -1) was passed
for example: dmenu -m '-9001'
This commit is contained in:
parent
aa92cd68bd
commit
d14670b995
4
dmenu.c
4
dmenu.c
|
@ -541,7 +541,7 @@ setup(void)
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
if ((info = XineramaQueryScreens(dpy, &n))) {
|
if ((info = XineramaQueryScreens(dpy, &n))) {
|
||||||
XGetInputFocus(dpy, &w, &di);
|
XGetInputFocus(dpy, &w, &di);
|
||||||
if (mon != -1 && mon < n)
|
if (mon >= 0 && mon < n)
|
||||||
i = mon;
|
i = mon;
|
||||||
else if (w != root && w != PointerRoot && w != None) {
|
else if (w != root && w != PointerRoot && w != None) {
|
||||||
/* find top-level window containing current input focus */
|
/* find top-level window containing current input focus */
|
||||||
|
@ -558,7 +558,7 @@ setup(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* no focused window is on screen, so use pointer location instead */
|
/* no focused window is on screen, so use pointer location instead */
|
||||||
if (mon == -1 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
|
if (mon < 0 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
if (INTERSECT(x, y, 1, 1, info[i]))
|
if (INTERSECT(x, y, 1, 1, info[i]))
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue