summaryrefslogtreecommitdiff
path: root/dmenu.c
diff options
context:
space:
mode:
authortsxv478 <vt0451@yandex.ru>2022-09-21 03:34:51 +0300
committertsxv478 <vt0451@yandex.ru>2022-09-21 03:34:51 +0300
commit27692ca057da9cc48b3c32b83586e0778594399b (patch)
treea27312d6087c3dc08570dcc30637e2532796921b /dmenu.c
parent6eadd6785a89591469b3c6b5660af79952f22322 (diff)
do not calculate width when centered, always use same width
Diffstat (limited to 'dmenu.c')
-rw-r--r--dmenu.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/dmenu.c b/dmenu.c
index 3afa794..980d3cf 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -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 {