Make dmenu full width

This commit is contained in:
Victor Timofei 2021-06-27 17:25:17 +03:00
parent b319d66e78
commit c67ba38005
Signed by: vtimofei
GPG Key ID: B790DCEBE281403A
1 changed files with 2 additions and 11 deletions

13
dmenu.c
View File

@ -102,15 +102,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)
{
@ -793,7 +784,7 @@ setup(void)
if (INTERSECT(x, y, 1, 1, info[i]))
break;
mw = MIN(MAX(max_textw() + promptw, 100), info[i].width);
mw = info[i].width;
x = info[i].x_org + ((info[i].width - mw) / 2);
y = info[i].y_org + ((info[i].height - mh) / 2);
XFree(info);
@ -803,7 +794,7 @@ setup(void)
if (!XGetWindowAttributes(dpy, parentwin, &wa))
die("could not get embedding window attributes: 0x%lx",
parentwin);
mw = MIN(MAX(max_textw() + promptw, 100), wa.width);
mw = wa.width;
x = (wa.width - mw) / 2;
y = (wa.height - mh) / 2;
}