replaced promptw 06c18808
Connor Lane Smith · 2010-08-02 14:49 2 file(s) · +6 −3
Makefile +1 −1
26 26
dist: clean
27 27
	@echo creating dist tarball
28 28
	@mkdir -p dmenu-${VERSION}
29 -
	@cp -R LICENSE Makefile README config.mk dmenu.1 dmenu.c dmenu_path dmenu_run dmenu-${VERSION}
29 +
	@cp LICENSE Makefile README config.mk dmenu.1 dmenu.c dmenu_path dmenu_run dmenu-${VERSION}
30 30
	@tar -cf dmenu-${VERSION}.tar dmenu-${VERSION}
31 31
	@gzip dmenu-${VERSION}.tar
32 32
	@rm -rf dmenu-${VERSION}
dmenu.c +5 −2
42 42
static void usage(void);
43 43
44 44
static char text[4096];
45 +
static int promptw;
45 46
static size_t cursor = 0;
46 47
static const char *prompt = NULL;
47 48
static const char *normbgcolor = "#cccccc";
79 80
calcoffsetsh(void) {
80 81
	unsigned int w, x;
81 82
82 -
	w = (prompt ? textw(dc, prompt) : 0) + inputw + textw(dc, "<") + textw(dc, ">");
83 +
	w = promptw + inputw + textw(dc, "<") + textw(dc, ">");
83 84
	for(x = w, next = curr; next; next = next->right)
84 85
		if((x += MIN(textw(dc, next->text), mw / 3)) > mw)
85 86
			break;
118 119
	dc->y = topbar ? 0 : mh - dc->h;
119 120
	/* print prompt? */
120 121
	if(prompt) {
121 -
		dc->w = textw(dc, prompt);
122 +
		dc->w = promptw;
122 123
		drawtext(dc, prompt, selcol);
123 124
		dc->x = dc->w;
124 125
	}
506 507
	grabkeyboard();
507 508
	setcanvas(dc, win, mw, mh);
508 509
	inputw = MIN(inputw, mw/3);
510 +
	promptw = prompt ? MIN(textw(dc, prompt), mw/5) : 0;
509 511
	XMapRaised(dc->dpy, win);
512 +
	text[0] = '\0';
510 513
	match();
511 514
}
512 515