Now xmenu detects if a menu has an icon, and if it doesn't have, the
menu will not have the gaps fgor icons, making the -i flag unecessary
to disable the padding. The -i option is still necessary, however,
to speed up xmenu loading, since it disables imlib2 initialization
routines.
menu->y = 0; /* calculated by setupmenu() */
menu->level = level;
menu->drawn = 0;
menu->y = 0; /* calculated by setupmenu() */
menu->level = level;
menu->drawn = 0;
swa.override_redirect = (wflag) ? False : True;
swa.background_pixel = dc.normal[ColorBG].pixel;
swa.override_redirect = (wflag) ? False : True;
swa.background_pixel = dc.normal[ColorBG].pixel;
+ if (curritem->file)
+ prevmenu->hasicon = 1;
+
* padding appears 3 times: before the label and around the triangle.
*/
itemwidth = textwidth + config.triangle_width + config.horzpadding * 3;
* padding appears 3 times: before the label and around the triangle.
*/
itemwidth = textwidth + config.triangle_width + config.horzpadding * 3;
- itemwidth += (iflag) ? 0 : config.iconsize + config.horzpadding;
+ itemwidth += (iflag || !menu->hasicon) ? 0 : config.iconsize + config.horzpadding;
menu->w = MAX(menu->w, itemwidth);
}
}
menu->w = MAX(menu->w, itemwidth);
}
}
/* draw text */
x = config.horzpadding;
/* draw text */
x = config.horzpadding;
- x += (iflag) ? 0 : config.horzpadding + config.iconsize;
+ x += (iflag || !menu->hasicon) ? 0 : config.horzpadding + config.iconsize;
dsel = XftDrawCreate(dpy, item->sel, visual, colormap);
dunsel = XftDrawCreate(dpy, item->unsel, visual, colormap);
XSetForeground(dpy, dc.gc, dc.selected[ColorFG].pixel);
dsel = XftDrawCreate(dpy, item->sel, visual, colormap);
dunsel = XftDrawCreate(dpy, item->unsel, visual, colormap);
XSetForeground(dpy, dc.gc, dc.selected[ColorFG].pixel);
struct Item *list; /* list of items contained by the menu */
struct Item *selected; /* item currently selected in the menu */
int x, y, w, h; /* menu geometry */
struct Item *list; /* list of items contained by the menu */
struct Item *selected; /* item currently selected in the menu */
int x, y, w, h; /* menu geometry */
+ int hasicon; /* whether the menu has item with icons */
int drawn; /* whether the menu was already drawn */
unsigned level; /* menu level relative to root */
Window win; /* menu window to map on the screen */
int drawn; /* whether the menu was already drawn */
unsigned level; /* menu level relative to root */
Window win; /* menu window to map on the screen */