Fix X11 warnings

This commit is contained in:
Dean Luick
2021-01-17 18:17:13 -06:00
parent 8ddab09cab
commit cf3ad240ac
4 changed files with 26 additions and 21 deletions

View File

@@ -327,7 +327,7 @@ extern void get_widget_window_geometry(Widget, int *, int *, int *, int *);
extern char *fontname_boldify(const char *);
extern Dimension nhFontHeight(Widget);
extern char key_event_to_char(XKeyEvent *);
extern void msgkey(Widget, XtPointer, XEvent *);
extern void msgkey(Widget, XtPointer, XEvent *, Boolean *);
extern void highlight_yn(boolean);
extern void nh_XtPopup(Widget, int, Widget);
extern void nh_XtPopdown(Widget);

View File

@@ -942,7 +942,7 @@ X11_putstr(winid window, int attr, const char *str)
X11_destroy_nhwindow(window);
*wp = window_list[new_win];
window_list[new_win].type = NHW_NONE; /* allow re-use */
/* fall though to add text */
/* fall through */
case NHW_TEXT:
add_to_text_window(wp, attr, str);
break;
@@ -1437,6 +1437,21 @@ panic_on_error(Display *display, XErrorEvent *error)
return 0;
}
static void
X11_error_handler(String str)
{
nhUse(str);
hangup(1);
}
static int
X11_io_error_handler(Display *display)
{
nhUse(display);
hangup(1);
return 0;
}
void
X11_init_nhwindows(int *argcp, char **argv)
{
@@ -1465,7 +1480,7 @@ X11_init_nhwindows(int *argcp, char **argv)
savuid = geteuid();
(void) seteuid(getuid());
XSetIOErrorHandler((XIOErrorHandler) hangup);
XSetIOErrorHandler((XIOErrorHandler) X11_io_error_handler);
num_args = 0;
XtSetArg(args[num_args], XtNallowShellResize, True); num_args++;
@@ -2248,12 +2263,13 @@ input_event(int exit_condition)
/*ARGSUSED*/
void
msgkey(Widget w, XtPointer data, XEvent *event)
msgkey(Widget w, XtPointer data, XEvent *event, Boolean *continue_to_dispatch)
{
Cardinal num = 0;
nhUse(w);
nhUse(data);
nhUse(continue_to_dispatch);
map_input(window_list[WIN_MAP].w, event, (String *) 0, &num);
}
@@ -2513,7 +2529,7 @@ init_standard_windows(void)
set_message_slider(&window_list[message_win]);
/* attempt to catch fatal X11 errors before the program quits */
(void) XtAppSetErrorHandler(app_context, (XtErrorHandler) hangup);
(void) XtAppSetErrorHandler(app_context, X11_error_handler);
highlight_yn(TRUE); /* switch foreground and background */

View File

@@ -1225,7 +1225,6 @@ map_exposed(Widget w, XtPointer client_data, /* unused */
static void
map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int stop_col, boolean inverted)
{
int win_start_row, win_start_col;
struct map_info_t *map_info = wp->map_information;
int row;
register int count;
@@ -1243,8 +1242,6 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
printf("update: [0x%x] %d %d %d %d\n",
(int) wp->w, start_row, stop_row, start_col, stop_col);
#endif
win_start_row = start_row;
win_start_col = start_col;
if (map_info->is_tile) {
struct tile_map_info_t *tile_map = &map_info->tile_map;
@@ -1371,6 +1368,10 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
#else /* !TEXTCOLOR */
{
int win_row, win_xstart;
int win_start_row, win_start_col;
win_start_row = start_row;
win_start_col = start_col;
/* We always start at the same x window position and have
the same character count. */

View File

@@ -474,7 +474,7 @@ X11_player_selection_randomize(void)
int nrole = plsel_n_roles;
int nrace = plsel_n_races;
int ro, ra, al, ge;
boolean fully_specified_role, choose_race_first;
boolean choose_race_first;
boolean picksomething = (flags.initrole == ROLE_NONE
|| flags.initrace == ROLE_NONE
|| flags.initgend == ROLE_NONE
@@ -497,15 +497,11 @@ X11_player_selection_randomize(void)
ro = flags.initrole;
if (ro == ROLE_NONE || ro == ROLE_RANDOM) {
ro = rn2(nrole);
if (flags.initrole != ROLE_RANDOM) {
fully_specified_role = FALSE;
}
}
ra = flags.initrace;
if (ra == ROLE_NONE || ra == ROLE_RANDOM) {
ra = rn2(nrace);
if (flags.initrace != ROLE_RANDOM) {
fully_specified_role = FALSE;
}
}
@@ -519,21 +515,14 @@ X11_player_selection_randomize(void)
while (!validrace(ro, ra)) {
if (choose_race_first) {
ro = rn2(nrole);
if (flags.initrole != ROLE_RANDOM) {
fully_specified_role = FALSE;
}
} else {
ra = rn2(nrace);
if (flags.initrace != ROLE_RANDOM) {
fully_specified_role = FALSE;
}
}
}
ge = flags.initgend;
if (ge == ROLE_NONE) {
ge = rn2(ROLE_GENDERS);
fully_specified_role = FALSE;
}
while (!validgend(ro, ra, ge)) {
ge = rn2(ROLE_GENDERS);
@@ -542,7 +531,6 @@ X11_player_selection_randomize(void)
al = flags.initalign;
if (al == ROLE_NONE) {
al = rn2(ROLE_ALIGNS);
fully_specified_role = FALSE;
}
while (!validalign(ro, ra, al)) {
al = rn2(ROLE_ALIGNS);