aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dmenu.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/dmenu.c b/dmenu.c
index f93407d..1762dba 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -212,12 +212,12 @@ drawmenu(void) {
212 dc.h = mh; 212 dc.h = mh;
213 drawtext(NULL, dc.norm); 213 drawtext(NULL, dc.norm);
214 /* print prompt? */ 214 /* print prompt? */
215 if(promptw) { 215 if(prompt) {
216 dc.w = promptw; 216 dc.w = promptw;
217 drawtext(prompt, dc.sel); 217 drawtext(prompt, dc.sel);
218 dc.x += dc.w;
218 } 219 }
219 dc.x += promptw; 220 dc.w = mw - dc.x;
220 dc.w = mw - promptw;
221 /* print command */ 221 /* print command */
222 if(cmdw && item && lines == 0) 222 if(cmdw && item && lines == 0)
223 dc.w = cmdw; 223 dc.w = cmdw;
@@ -241,14 +241,13 @@ drawmenuh(void) {
241 dc.w = spaceitem; 241 dc.w = spaceitem;
242 drawtext(curr->left ? "<" : NULL, dc.norm); 242 drawtext(curr->left ? "<" : NULL, dc.norm);
243 dc.x += dc.w; 243 dc.x += dc.w;
244 /* determine maximum items */
245 for(i = curr; i != next; i=i->right) { 244 for(i = curr; i != next; i=i->right) {
246 dc.w = MIN(textw(i->text), mw / 3); 245 dc.w = MIN(textw(i->text), mw / 3);
247 drawtext(i->text, (sel == i) ? dc.sel : dc.norm); 246 drawtext(i->text, (sel == i) ? dc.sel : dc.norm);
248 dc.x += dc.w; 247 dc.x += dc.w;
249 } 248 }
250 dc.x = mw - spaceitem;
251 dc.w = spaceitem; 249 dc.w = spaceitem;
250 dc.x = mw - dc.w;
252 drawtext(next ? ">" : NULL, dc.norm); 251 drawtext(next ? ">" : NULL, dc.norm);
253} 252}
254 253
@@ -259,7 +258,6 @@ drawmenuv(void) {
259 dc.x = 0; 258 dc.x = 0;
260 dc.w = mw; 259 dc.w = mw;
261 dc.y += dc.font.height + 2; 260 dc.y += dc.font.height + 2;
262 /* determine maximum items */
263 for(i = curr; i != next; i=i->right) { 261 for(i = curr; i != next; i=i->right) {
264 drawtext(i->text, (sel == i) ? dc.sel : dc.norm); 262 drawtext(i->text, (sel == i) ? dc.sel : dc.norm);
265 dc.y += dc.font.height + 2; 263 dc.y += dc.font.height + 2;
@@ -340,13 +338,11 @@ initfont(const char *fontstr) {
340 if(missing) 338 if(missing)
341 XFreeStringList(missing); 339 XFreeStringList(missing);
342 if(dc.font.set) { 340 if(dc.font.set) {
343 XFontSetExtents *font_extents;
344 XFontStruct **xfonts; 341 XFontStruct **xfonts;
345 char **font_names; 342 char **font_names;
346 dc.font.ascent = dc.font.descent = 0; 343 dc.font.ascent = dc.font.descent = 0;
347 font_extents = XExtentsOfFontSet(dc.font.set);
348 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); 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 dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent); 346 dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
351 dc.font.descent = MAX(dc.font.descent, (*xfonts)->descent); 347 dc.font.descent = MAX(dc.font.descent, (*xfonts)->descent);
352 xfonts++; 348 xfonts++;