[hackers] [dmenu] inputw: improve correctness and startup performance, by NRK || Hiltjo Posthuma
commit e1e1de7b3b8399cba90ddca9613f837b2dbef7b9
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Fri Apr 29 20:15:48 2022 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Fri Apr 29 20:18:02 2022 +0200
inputw: improve correctness and startup performance, by NRK
Always use ~30% of the monitor width for the input in horizontal mode.
Patch adapted from NRK patches.
This also does not calculate inputw when using vertical mode anymore (because
the code is removed).
diff --git a/dmenu.c b/dmenu.c
index 839f6cc..4e286cf 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -610,13 +610,12 @@ static void
setup(void)
{
int x, y, i, j;
- unsigned int du, tmp;
+ unsigned int du;
XSetWindowAttributes swa;
XIM xim;
Window w, dw, *dws;
XWindowAttributes wa;
XClassHint ch = {"dmenu", "dmenu"};
- struct item *item;
#ifdef XINERAMA
XineramaScreenInfo *info;
Window pw;
_AT_@ -674,12 +673,7 @@ setup(void)
mw = wa.width;
}
promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
- for (item = items; item && item->text; ++item) {
- if ((tmp = textw_clamp(item->text, mw/3)) > inputw) {
- if ((inputw = tmp) == mw/3)
- break;
- }
- }
+ inputw = mw / 3; /* input width: ~30% of monitor width */
match();
/* create menu window */
Received on Fri Apr 29 2022 - 20:19:20 CEST
This archive was generated by hypermail 2.3.0
: Fri Apr 29 2022 - 20:24:33 CEST