aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-04-29 20:15:48 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-04-29 20:18:02 +0200
commite1e1de7b3b8399cba90ddca9613f837b2dbef7b9 (patch)
tree1ad5d2e15e4bf0e32722fceb40f5a6dd993e1097
parent33685b06e9332638769e677e77b257e24e069fd1 (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 839f6cc..4e286cf 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -610,13 +610,12 @@ static void
610setup(void) 610setup(void)
611{ 611{
612 int x, y, i, j; 612 int x, y, i, j;
613 unsigned int du, tmp; 613 unsigned int du;
614 XSetWindowAttributes swa; 614 XSetWindowAttributes swa;
615 XIM xim; 615 XIM xim;
616 Window w, dw, *dws; 616 Window w, dw, *dws;
617 XWindowAttributes wa; 617 XWindowAttributes wa;
618 XClassHint ch = {"dmenu", "dmenu"}; 618 XClassHint ch = {"dmenu", "dmenu"};
619 struct item *item;
620#ifdef XINERAMA 619#ifdef XINERAMA
621 XineramaScreenInfo *info; 620 XineramaScreenInfo *info;
622 Window pw; 621 Window pw;
@@ -674,12 +673,7 @@ setup(void)
674 mw = wa.width; 673 mw = wa.width;
675 } 674 }
676 promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; 675 promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
677 for (item = items; item && item->text; ++item) { 676 inputw = mw / 3; /* input width: ~30% of monitor width */
678 if ((tmp = textw_clamp(item->text, mw/3)) > inputw) {
679 if ((inputw = tmp) == mw/3)
680 break;
681 }
682 }
683 match(); 677 match();
684 678
685 /* create menu window */ 679 /* create menu window */