summaryrefslogtreecommitdiff
path: root/core/dmenu/dmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/dmenu/dmenu.c')
-rw-r--r--core/dmenu/dmenu.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/core/dmenu/dmenu.c b/core/dmenu/dmenu.c
index b009179..6ca6db6 100644
--- a/core/dmenu/dmenu.c
+++ b/core/dmenu/dmenu.c
@@ -41,6 +41,7 @@ struct item {
static char text[BUFSIZ] = "";
static char *embed;
static int bh, mw, mh;
+static int ih;
static int promptw;
static int lrpad; /* sum of left and right padding */
static size_t cursor;
@@ -169,26 +170,30 @@ drawmenu(void)
if (prompt && *prompt) {
drw_setscheme(drw, scheme[SchemeSel]);
- x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0);
+ x = drw_text(drw, x, 0, promptw, ih, lrpad / 2, prompt, 0);
}
/* draw input field */
w = mw - x;
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
+ drw_text(drw, x, 0, w, ih, lrpad / 2, text, 0);
curpos = TEXTW(text) - TEXTW(&text[cursor]);
if ((curpos += lrpad / 2 - 1) < w) {
+ int cy = (ih - bh) / 2 + 2;
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
+ drw_rect(drw, x + curpos, cy, 2, bh - 4, 1, 0);
}
+ drw_setscheme(drw, accent);
+ drw_rect(drw, 0, ih - 1, mw, 1, 1, 1);
+
+ y = ih;
for (item = curr; item != next; item = item->right) {
- y += bh;
drawitem(item, x, y, mw - x);
drw_setscheme(drw, accent);
drw_rect(drw, x, y + bh - 1, mw - x, 1, 1, 1);
+ y += bh;
}
-
drw_map(drw, win, 0, 0, mw, mh);
}
@@ -637,6 +642,7 @@ setup(void)
/* calculate menu geometry */
bh = drw->fonts->h + 2;
+ ih = (bh * 3) / 2;
#ifdef XINERAMA
i = 0;
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {
@@ -661,9 +667,9 @@ setup(void)
break;
mw = info[i].width / 2;
- int max_lines = info[i].height / bh - 1;
+ int max_lines = (info[i].height - ih) / bh;
lines = lines ? MIN(lines, max_lines) : MIN(20, max_lines);
- mh = (lines + 1) * bh;
+ mh = ih + lines * bh;
x = info[i].x_org + (info[i].width - mw) / 2;
y = info[i].y_org + (info[i].height - mh) / 2;
XFree(info);
@@ -674,9 +680,9 @@ setup(void)
die("could not get embedding window attributes: 0x%lx",
parentwin);
mw = wa.width / 2;
- int max_lines = wa.height / bh - 1;
+ int max_lines = (wa.height - ih) / bh;
lines = lines ? MIN(lines, max_lines) : MIN(20, max_lines);
- mh = (lines + 1) * bh;
+ mh = ih + lines * bh;
x = (wa.width - mw) / 2;
y = (wa.height - mh) / 2;
}