cleaning up a6835349
Connor Lane Smith · 2010-05-02 23:17 1 file(s) · +5 −9
dmenu.c +5 −9
212 212
	dc.h = mh;
213 213
	drawtext(NULL, dc.norm);
214 214
	/* print prompt? */
215 -
	if(promptw) {
215 +
	if(prompt) {
216 216
		dc.w = promptw;
217 217
		drawtext(prompt, dc.sel);
218 +
		dc.x += dc.w;
218 219
	}
219 -
	dc.x += promptw;
220 -
	dc.w = mw - promptw;
220 +
	dc.w = mw - dc.x;
221 221
	/* print command */
222 222
	if(cmdw && item && lines == 0)
223 223
		dc.w = cmdw;
241 241
	dc.w = spaceitem;
242 242
	drawtext(curr->left ? "<" : NULL, dc.norm);
243 243
	dc.x += dc.w;
244 -
	/* determine maximum items */
245 244
	for(i = curr; i != next; i=i->right) {
246 245
		dc.w = MIN(textw(i->text), mw / 3);
247 246
		drawtext(i->text, (sel == i) ? dc.sel : dc.norm);
248 247
		dc.x += dc.w;
249 248
	}
250 -
	dc.x = mw - spaceitem;
251 249
	dc.w = spaceitem;
250 +
	dc.x = mw - dc.w;
252 251
	drawtext(next ? ">" : NULL, dc.norm);
253 252
}
254 253
259 258
	dc.x = 0;
260 259
	dc.w = mw;
261 260
	dc.y += dc.font.height + 2;
262 -
	/* determine maximum items */
263 261
	for(i = curr; i != next; i=i->right) {
264 262
		drawtext(i->text, (sel == i) ? dc.sel : dc.norm);
265 263
		dc.y += dc.font.height + 2;
340 338
	if(missing)
341 339
		XFreeStringList(missing);
342 340
	if(dc.font.set) {
343 -
		XFontSetExtents *font_extents;
344 341
		XFontStruct **xfonts;
345 342
		char **font_names;
346 343
		dc.font.ascent = dc.font.descent = 0;
347 -
		font_extents = XExtentsOfFontSet(dc.font.set);
348 344
		n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
349 -
		for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) {
345 +
		for(i = 0; i < n; i++) {
350 346
			dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
351 347
			dc.font.descent = MAX(dc.font.descent, (*xfonts)->descent);
352 348
			xfonts++;