Thu Aug 19 16:45:36 PDT 1999 Michael Jennings <mej@eterm.org>

Applied patch from Valdis Kletnieks <valdis.kletnieks@vt.edu> which
	reduces the amount of excess space in menus when using proportional
	fonts.


SVN revision: 61
This commit is contained in:
Michael Jennings 1999-08-19 23:48:05 +00:00
parent 52fbe59fac
commit 022e3021d3
2 changed files with 13 additions and 3 deletions

View File

@ -2295,3 +2295,10 @@ Wed Aug 18 18:17:14 PDT 1999 Michael Jennings <mej@eterm.org>
Thanks to Carl Lewis <carl@dpiwe.tas.gov.au> for pointing this out.
-------------------------------------------------------------------------------
Thu Aug 19 16:45:36 PDT 1999 Michael Jennings <mej@eterm.org>
Applied patch from Valdis Kletnieks <valdis.kletnieks@vt.edu> which
reduces the amount of excess space in menus when using proportional
fonts.
-------------------------------------------------------------------------------

View File

@ -827,6 +827,7 @@ menu_draw(menu_t * menu)
int ascent, descent, direction;
XCharStruct chars;
Screen *scr;
unsigned short longest = 0;
ASSERT(menu != NULL);
@ -839,18 +840,20 @@ menu_draw(menu_t * menu)
if (!menu->w) {
len = strlen(menu->title);
longest = XTextWidth(menu->font, menu->title, len);
height = menu->fheight + 3 * MENU_VGAP;
for (i = 0; i < menu->numitems; i++) {
unsigned short j = menu->items[i]->len;
menuitem_t *item = menu->items[i];
width = XTextWidth(menu->font, item->text, j);
if (item->rtext) {
j += item->rlen + 2;
width += XTextWidth(menu->font, item->rtext, item->rlen) + (2*MENU_HGAP);
}
MAX_IT(len, j);
longest = (longest>width)?longest:width;
height += ((item->type == MENUITEM_SEP) ? (MENU_VGAP) : (menu->fheight)) + MENU_VGAP;
}
width = len * menu->fwidth + (4 * MENU_HGAP);
width = longest + (4 * MENU_HGAP);
if (images[image_submenu].selected->iml->pad) {
width += images[image_submenu].selected->iml->pad->left + images[image_submenu].selected->iml->pad->right;
}