summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-04-29 20:15:48 +0200
committerrafa_99 <raroma09@gmail.com>2022-04-30 13:33:54 +0100
commit42135bf757c82cd039adb339683c905267beaacc (patch)
tree109e01338efa5a4d3f5ad2c27c7dd8ba8f0539e4
parent6fa66ba42548a31f5f46960a257a02a6b119e7f9 (diff)
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).
-rw-r--r--dmenu.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/dmenu.c b/dmenu.c
index 92110ea..a05ba4d 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -621,13 +621,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;
@@ -685,12 +684,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 */