diff options
| author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-07-26 23:13:06 +0200 |
|---|---|---|
| committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-07-26 23:13:06 +0200 |
| commit | d14670b9959f8b3760b63dd40a70687a90312b8a (patch) | |
| tree | 6e627d4fa9930366d4504f3e62c116367c6788ec | |
| parent | aa92cd68bdff95c181cc854043598e6c6007d45e (diff) | |
fix crash if negative monitor (< -1) was passed
for example: dmenu -m '-9001'
| -rw-r--r-- | dmenu.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -541,7 +541,7 @@ setup(void) | |||
| 541 | #ifdef XINERAMA | 541 | #ifdef XINERAMA |
| 542 | if ((info = XineramaQueryScreens(dpy, &n))) { | 542 | if ((info = XineramaQueryScreens(dpy, &n))) { |
| 543 | XGetInputFocus(dpy, &w, &di); | 543 | XGetInputFocus(dpy, &w, &di); |
| 544 | if (mon != -1 && mon < n) | 544 | if (mon >= 0 && mon < n) |
| 545 | i = mon; | 545 | i = mon; |
| 546 | else if (w != root && w != PointerRoot && w != None) { | 546 | else if (w != root && w != PointerRoot && w != None) { |
| 547 | /* find top-level window containing current input focus */ | 547 | /* find top-level window containing current input focus */ |
| @@ -558,7 +558,7 @@ setup(void) | |||
| 558 | } | 558 | } |
| 559 | } | 559 | } |
| 560 | /* no focused window is on screen, so use pointer location instead */ | 560 | /* no focused window is on screen, so use pointer location instead */ |
| 561 | if (mon == -1 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du)) | 561 | if (mon < 0 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du)) |
| 562 | for (i = 0; i < n; i++) | 562 | for (i = 0; i < n; i++) |
| 563 | if (INTERSECT(x, y, 1, 1, info[i])) | 563 | if (INTERSECT(x, y, 1, 1, info[i])) |
| 564 | break; | 564 | break; |
