Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2

This commit is contained in:
nhmall
2018-10-12 21:09:40 -04:00
8 changed files with 80 additions and 4 deletions
+28
View File
@@ -484,6 +484,34 @@ int *x, *y, *width, *height;
*y -= top;
}
/* Change the full font name string so the weight is "bold" */
char *
fontname_boldify(fontname)
const char *fontname;
{
static char buf[BUFSZ];
char *bufp = buf;
int idx = 0;
while (*fontname) {
if (*fontname == '-')
idx++;
*bufp = *fontname;
if (idx == 3) {
strcat(buf, "bold");
bufp += 5;
do {
fontname++;
} while (*fontname && *fontname != '-');
} else {
bufp++;
fontname++;
}
}
*bufp = '\0';
return buf;
}
#ifdef TEXTCOLOR
/* ARGSUSED */
static void
+41
View File
@@ -778,6 +778,31 @@ Widget form,under;
return all;
}
void
load_boldfont(wp, w)
struct xwindow *wp;
Widget w;
{
Arg args[1];
XFontStruct *fs;
unsigned long ret;
char *fontname;
Display *dpy;
if (wp->menu_information->boldfs)
return;
XtSetArg(args[0], nhStr(XtNfont), &fs);
XtGetValues(w, args, 1);
if (!XGetFontProperty(fs, XA_FONT, &ret))
return;
wp->menu_information->boldfs_dpy = dpy = XtDisplay(w);
fontname = fontname_boldify(XGetAtomName(dpy, (Atom)ret));
wp->menu_information->boldfs = XLoadQueryFont(dpy, fontname);
}
void
menu_create_entries(wp, curr_menu)
struct xwindow *wp;
@@ -843,6 +868,13 @@ struct menu *curr_menu;
: labelWidgetClass,
wp->w, args, num_args);
if (attr == ATR_BOLD) {
load_boldfont(wp, curr->w);
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNfont), wp->menu_information->boldfs); num_args++;
XtSetValues(curr->w, args, num_args);
}
if (canpick)
XtAddCallback(linewidget, XtNcallback, menu_select,
(XtPointer) curr);
@@ -1001,6 +1033,13 @@ menu_item **menu_list;
if (menu_info->is_up && permi && menu_info->curr_menu.base) {
/* perm_invent window - explicitly destroy old menu entry widgets,
without recreating whole window */
WidgetList wlist;
Cardinal numchild;
num_args = 0;
XtSetArg(args[num_args], XtNchildren, &wlist); num_args++;
XtSetArg(args[num_args], XtNnumChildren, &numchild); num_args++;
XtGetValues(wp->w, args, num_args);
XtUnmanageChildren(wlist, numchild);
for (curr = menu_info->curr_menu.base; curr; curr = curr->next)
if (curr->w)
XtDestroyWidget(curr->w);
@@ -1285,6 +1324,8 @@ destroy_menu_window(wp)
struct xwindow *wp;
{
clear_old_menu(wp); /* this will also destroy the widgets */
if (wp->menu_information->boldfs)
XFreeFont(wp->menu_information->boldfs_dpy, wp->menu_information->boldfs);
free((genericptr_t) wp->menu_information);
wp->menu_information = (struct menu_info_t *) 0;
wp->type = NHW_NONE; /* allow re-use */
+2 -1
View File
@@ -218,6 +218,7 @@
<DlbList Include = "$(DatDir)porthelp"/>
<DlbList Include = "$(DatDir)hh"/>
<DlbList Include = "$(DatDir)cmdhelp"/>
<DlbList Include = "$(DatDir)keyhelp"/>
<DlbList Include = "$(DatDir)history"/>
<DlbList Include = "$(DatDir)opthelp"/>
<DlbList Include = "$(DatDir)wizhelp"/>
@@ -225,4 +226,4 @@
<DlbList Include = "$(DatDir)license"/>
<DlbList Include = "$(DatDir)*.lev"/>
</ItemGroup>
</Project>
</Project>
+1
View File
@@ -218,6 +218,7 @@
<DlbList Include = "$(DatDir)porthelp"/>
<DlbList Include = "$(DatDir)hh"/>
<DlbList Include = "$(DatDir)cmdhelp"/>
<DlbList Include = "$(DatDir)keyhelp"/>
<DlbList Include = "$(DatDir)history"/>
<DlbList Include = "$(DatDir)opthelp"/>
<DlbList Include = "$(DatDir)wizhelp"/>