summaryrefslogtreecommitdiff
path: root/dmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'dmenu.c')
-rw-r--r--dmenu.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/dmenu.c b/dmenu.c
index 8463b4c..446ff0e 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -116,6 +116,7 @@ cistrstr(const char *s, const char *sub)
static int
drawitem(struct item *item, int x, int y, int w)
{
+ int zl = lines == 0;
if (item == sel)
drw_setscheme(drw, scheme[SchemeSel]);
else if (item->out)
@@ -123,7 +124,7 @@ drawitem(struct item *item, int x, int y, int w)
else
drw_setscheme(drw, scheme[SchemeNorm]);
- return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0);
+ return drw_text(drw, x, y + (borderline) * zl, w, bh + (border - borderline) * zl, lrpad / 2, item->text, 0);
}
static void
@@ -157,7 +158,7 @@ drawmenu(void)
drw_rect(drw, x + curpos + border + 2, border, 2, bh - border / 2 - 4, 1, 0);
}
- if (lines > 0) {
+ if (lines > 0 && matches) {
/* draw vertical list */
y += 2 * border;
for (item = curr; item != next; item = item->right)
@@ -168,7 +169,7 @@ drawmenu(void)
w = TEXTW("<");
if (curr->left) {
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, "<", 0);
+ drw_text(drw, x, 0, w, bh + border, lrpad / 2, "<", 0);
}
x += w;
for (item = curr; item != next; item = item->right)
@@ -176,7 +177,7 @@ drawmenu(void)
if (next) {
w = TEXTW(">");
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0);
+ drw_text(drw, mw - w, 0, w, bh + border, lrpad / 2, ">", 0);
}
}
drw_map(drw, win, 0, 0, mw, mh);
@@ -617,7 +618,7 @@ setup(void)
/* calculate menu geometry */
bh = drw->fonts->h + 2 * border / 2;
lines = MAX(lines, 0);
- mh = (lines + 1) * bh + 3 * border;
+ mh = (lines + 1) * bh + border * (1 + 2 * (lines > 0));
#ifdef XINERAMA
i = 0;
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {