inputw: improve correctness and startup performance, by NRK e1e1de7b
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).
Hiltjo Posthuma · 2022-04-29 20:15 1 file(s) · +2 −8
dmenu.c +2 −8
610 610
setup(void)
611 611
{
612 612
	int x, y, i, j;
613 -
	unsigned int du, tmp;
613 +
	unsigned int du;
614 614
	XSetWindowAttributes swa;
615 615
	XIM xim;
616 616
	Window w, dw, *dws;
617 617
	XWindowAttributes wa;
618 618
	XClassHint ch = {"dmenu", "dmenu"};
619 -
	struct item *item;
620 619
#ifdef XINERAMA
621 620
	XineramaScreenInfo *info;
622 621
	Window pw;
674 673
		mw = wa.width;
675 674
	}
676 675
	promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
677 -
	for (item = items; item && item->text; ++item) {
678 -
		if ((tmp = textw_clamp(item->text, mw/3)) > inputw) {
679 -
			if ((inputw = tmp) == mw/3)
680 -
				break;
681 -
		}
682 -
	}
676 +
	inputw = mw / 3; /* input width: ~30% of monitor width */
683 677
	match();
684 678
685 679
	/* create menu window */