xyw vs center patch - allow xyw control the width of dmenu when centered ref. #29

This commit is contained in:
bakkeby 2024-06-19 08:37:05 +02:00
parent 9ef1b3c317
commit d04595790f

View File

@ -1645,7 +1645,11 @@ setup(void)
#if CENTER_PATCH #if CENTER_PATCH
if (center) { if (center) {
#if XYW_PATCH
mw = (dmw>0 ? dmw : MIN(MAX(max_textw() + promptw, min_width), info[i].width));
#else
mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width); mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width);
#endif // XYW_PATCH
x = info[i].x_org + ((info[i].width - mw) / 2); x = info[i].x_org + ((info[i].width - mw) / 2);
y = info[i].y_org + ((info[i].height - mh) / 2); y = info[i].y_org + ((info[i].height - mh) / 2);
} else { } else {
@ -1677,7 +1681,11 @@ setup(void)
parentwin); parentwin);
#if CENTER_PATCH #if CENTER_PATCH
if (center) { if (center) {
#if XYW_PATCH
mw = (dmw>0 ? dmw : MIN(MAX(max_textw() + promptw, min_width), wa.width));
#else
mw = MIN(MAX(max_textw() + promptw, min_width), wa.width); mw = MIN(MAX(max_textw() + promptw, min_width), wa.width);
#endif // XYW_PATCH
x = (wa.width - mw) / 2; x = (wa.width - mw) / 2;
y = (wa.height - mh) / 2; y = (wa.height - mh) / 2;
} else { } else {