diff options
author | tsxv478 <vt0451@yandex.ru> | 2022-09-21 03:34:51 +0300 |
---|---|---|
committer | tsxv478 <vt0451@yandex.ru> | 2022-09-21 03:34:51 +0300 |
commit | 27692ca057da9cc48b3c32b83586e0778594399b (patch) | |
tree | a27312d6087c3dc08570dcc30637e2532796921b | |
parent | 6eadd6785a89591469b3c6b5660af79952f22322 (diff) |
do not calculate width when centered, always use same width
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | dmenu.c | 13 |
2 files changed, 3 insertions, 12 deletions
diff --git a/config.def.h b/config.def.h index 70b495d..2602882 100644 --- a/config.def.h +++ b/config.def.h @@ -3,7 +3,7 @@ static int topbar = 0; /* -b option; if 0, dmenu appears at bottom */ static int centered = 0; /* -c option; centers dmenu on screen */ -static int min_width = 500; /* minimum width when centered */ +static int centered_width = 800; /* width when centered */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { "monospace:size=11" @@ -96,15 +96,6 @@ calcoffsets(void) break; } -static int -max_textw(void) -{ - int len = 0; - for (struct item *item = items; item && item->text; item++) - len = MAX(TEXTW(item->text), len); - return len; -} - static void cleanup(void) { @@ -677,7 +668,7 @@ setup(void) break; if (centered) { - mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width); + mw = centered_width; x = info[i].x_org + ((info[i].width - mw) / 2); y = info[i].y_org + ((info[i].height - mh) / 2); } else { @@ -695,7 +686,7 @@ setup(void) parentwin); if (centered) { - mw = MIN(MAX(max_textw() + promptw, min_width), wa.width); + mw = centered_width; x = (wa.width - mw) / 2; y = (wa.height - mh) / 2; } else { |