\#perminv, 1 of 2: groundwork

Give the window-port side of *_update_inventory() an argument.
Calls in the core still omit that; invent.c's update_inventory()
is the only place that cares.
This commit is contained in:
PatR
2021-03-13 18:17:00 -08:00
parent 160344feaa
commit dd49431296
21 changed files with 235 additions and 179 deletions
+30 -8
View File
@@ -84,7 +84,7 @@ AppResources appResources;
void (*input_func)(Widget, XEvent *, String *, Cardinal *);
int click_x, click_y, click_button; /* Click position on a map window */
/* (filled by set_button_values()). */
int updated_inventory;
int updated_inventory; /* used to indicate perm_invent updating */
static int (*old_error_handler) (Display *, XErrorEvent *);
@@ -1239,8 +1239,9 @@ X11_destroy_nhwindow(winid window)
}
}
/* display persistent inventory in its own window */
void
X11_update_inventory(void)
X11_update_inventory(int arg UNUSED)
{
struct xwindow *wp = 0;
@@ -1259,6 +1260,7 @@ X11_update_inventory(void)
/* persistent inventory is up but perm_invent is off, take it down */
x11_no_perminv(wp);
}
return;
}
/* The current implementation has all of the saved lines on the screen. */
@@ -2150,19 +2152,21 @@ release_yn_widgets(void)
XtDestroyWidget(yn_popup), yn_popup = (Widget) 0;
}
/* X11-specific edition of yn_function(), the routine called by the core
to show a prompt and get a single keystroke answer, often 'y' vs 'n' */
/* guts of the X11_yn_function(), not to be confused with core code;
requires an extra argument: ynflags */
char
X11_yn_function(
X11_yn_function_core(
const char *ques, /* prompt text */
const char *choices, /* allowed response chars; any char if Null */
char def) /* default if user hits <space> or <return> */
char def, /* default if user hits <space> or <return> */
unsigned ynflags) /* flags; currently just log-it or not */
{
static XFontStruct *yn_font = 0;
static Dimension yn_minwidth = 0;
char buf[BUFSZ], buf2[BUFSZ];
Arg args[4];
Cardinal num_args;
boolean suppress_logging = (ynflags & YN_NO_LOGMESG) != 0U;
yn_choices = choices; /* set up globals for callback to use */
yn_def = def;
@@ -2341,12 +2345,28 @@ X11_yn_function(
nh_XtPopdown(yn_popup); /* this removes the event grab */
}
char *p = trimspaces(buf); /* remove !slow's extra whitespace */
pline("%s %s", p, (yn_return == '\033') ? "ESC" : visctrl(yn_return));
if (!suppress_logging) {
char *p = trimspaces(buf); /* remove !slow's extra whitespace */
pline("%s %s", p, (yn_return == '\033') ? "ESC" : visctrl(yn_return));
}
return yn_return;
}
/* X11-specific edition of yn_function(), the routine called by the core
to show a prompt and get a single key answer, often 'y' vs 'n' */
char
X11_yn_function(
const char *ques, /* prompt text */
const char *choices, /* allowed response chars; any char if Null */
char def) /* default if user hits <space> or <return> */
{
char res = X11_yn_function_core(ques, choices, def, YN_NORMAL);
return res;
}
/* used when processing window-capability-specific run-time options;
we support toggling tiles on and off via iflags.wc_tiled_map */
void
@@ -2355,6 +2375,8 @@ X11_preference_update(const char *pref)
if (!strcmp(pref, "tiled_map")) {
if (WIN_MAP != WIN_ERR)
display_map_window(&window_list[WIN_MAP]);
} else if (!strcmp(pref, "perm_invent")) {
; /* TODO... */
}
}