switch source tree from k&r to c99

This commit is contained in:
nhmall
2021-01-26 21:06:16 -05:00
parent a2a9cb7b4f
commit f963c5aca7
232 changed files with 12099 additions and 17782 deletions
+8 -15
View File
@@ -91,11 +91,10 @@ static XtResource resources[] = {
/* ARGSUSED */
static void
no_op(w, event, params, num_params)
Widget w; /* unused */
XEvent *event; /* unused */
String *params; /* unused */
Cardinal *num_params; /* unused */
no_op(Widget w, /* unused */
XEvent *event, /* unused */
String *params, /* unused */
Cardinal *num_params) /* unused */
{
nhUse(w);
nhUse(event);
@@ -114,10 +113,7 @@ static char translations[] = "<BtnDown>: input() \
/* ARGSUSED */
static void
Redisplay(w, event, region)
Widget w;
XEvent *event;
Region region; /* unused */
Redisplay(Widget w, XEvent *event, Region region /* unused */)
{
nhUse(region);
@@ -127,8 +123,7 @@ Region region; /* unused */
/* ARGSUSED */
static void
Resize(w)
Widget w;
Resize(Widget w)
{
XtCallCallbacks(w, XtNresizeCallback, (XtPointer) 0);
}
@@ -174,15 +169,13 @@ WindowClassRec windowClassRec = {
WidgetClass windowWidgetClass = (WidgetClass) &windowClassRec;
Font
WindowFont(w)
Widget w;
WindowFont(Widget w)
{
return ((WindowWidget) w)->window.font->fid;
}
XFontStruct *
WindowFontStruct(w)
Widget w;
WindowFontStruct(Widget w)
{
return ((WindowWidget) w)->window.font;
}
+8 -21
View File
@@ -97,11 +97,8 @@ static const char cancel_accelerators[] = "#override\n\
* an optional cancel button
*/
Widget
CreateDialog(parent, name, okay_callback, cancel_callback)
Widget parent;
String name;
XtCallbackProc okay_callback;
XtCallbackProc cancel_callback;
CreateDialog(Widget parent, String name, XtCallbackProc okay_callback,
XtCallbackProc cancel_callback)
{
Widget form, prompt, response, okay, cancel;
Arg args[20];
@@ -218,8 +215,7 @@ XtCallbackProc cancel_callback;
/* get the prompt from the dialog box. Used a startup time to
* save away the initial prompt */
String
GetDialogPrompt(w)
Widget w;
GetDialogPrompt(Widget w)
{
Arg args[1];
Widget label;
@@ -234,9 +230,7 @@ GetDialogPrompt(w)
/* set the prompt. This is used to put error information in the prompt */
void
SetDialogPrompt(w, newprompt)
Widget w;
String newprompt;
SetDialogPrompt(Widget w, String newprompt)
{
Arg args[1];
Widget label;
@@ -248,8 +242,7 @@ String newprompt;
/* get what the user typed; caller must free the response */
String
GetDialogResponse(w)
Widget w;
GetDialogResponse(Widget w)
{
Arg args[1];
Widget response;
@@ -263,10 +256,7 @@ Widget w;
/* set the default reponse */
void
SetDialogResponse(w, s, ln)
Widget w;
String s;
unsigned ln;
SetDialogResponse(Widget w, String s, unsigned ln)
{
Arg args[4];
Widget response;
@@ -296,8 +286,7 @@ unsigned ln;
#if 0
/* clear the response */
void
ClearDialogResponse(w)
Widget w;
ClearDialogResponse(Widget w)
{
Arg args[2];
Widget response;
@@ -313,9 +302,7 @@ ClearDialogResponse(w)
/* position popup window under the cursor */
void
positionpopup(w, bottom)
Widget w;
boolean bottom; /* position y on bottom? */
positionpopup(Widget w, boolean bottom) /* position y on bottom? */
{
Arg args[3];
Cardinal num_args;
+9 -15
View File
@@ -22,13 +22,12 @@ unsigned char tile_bytes[TILE_X * TILE_Y * (MAX_GLYPH + TILES_PER_ROW)];
unsigned char *curr_tb = tile_bytes;
unsigned char x11_colormap[MAXCOLORMAPSIZE][3];
extern void NDECL(monst_globals_init);
extern void NDECL(objects_globals_init);
extern void monst_globals_init(void);
extern void objects_globals_init(void);
/* Look up the given pixel and return its colormap index. */
static unsigned char
pix_to_colormap(pix)
pixel pix;
pix_to_colormap(pixel pix)
{
unsigned long i;
@@ -49,9 +48,8 @@ pixel pix;
/* Convert the tiles in the file to our format of bytes. */
static unsigned long
convert_tiles(tb_ptr, total)
unsigned char **tb_ptr; /* pointer to a tile byte pointer */
unsigned long total; /* total tiles so far */
convert_tiles(unsigned char **tb_ptr, /* pointer to a tile byte pointer */
unsigned long total) /* total tiles so far */
{
unsigned char *tb = *tb_ptr;
unsigned long count = 0;
@@ -79,7 +77,7 @@ unsigned long total; /* total tiles so far */
/* Merge the current text colormap (ColorMap) with ours (x11_colormap). */
static void
merge_text_colormap()
merge_text_colormap(void)
{
unsigned i, j;
@@ -112,8 +110,7 @@ merge_text_colormap()
/* Open the given file, read & merge the colormap, convert the tiles. */
static void
process_file(fname)
char *fname;
process_file(char *fname)
{
unsigned long count;
@@ -130,8 +127,7 @@ char *fname;
#ifdef USE_XPM
static int
xpm_write(fp)
FILE *fp;
xpm_write(FILE *fp)
{
unsigned long i, j;
unsigned n;
@@ -169,9 +165,7 @@ FILE *fp;
#endif /* USE_XPM */
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char *argv[])
{
FILE *fp;
int i;
+115 -217
View File
@@ -81,7 +81,7 @@ static struct icon_info {
*/
struct xwindow window_list[MAX_WINDOWS];
AppResources appResources;
void FDECL((*input_func), (Widget, XEvent *, String *, Cardinal *));
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;
@@ -143,34 +143,34 @@ struct window_procs X11_procs = {
/*
* Local functions.
*/
static winid NDECL(find_free_window);
static winid find_free_window(void);
#ifdef TEXTCOLOR
static void FDECL(nhFreePixel, (XtAppContext, XrmValuePtr, XtPointer,
XrmValuePtr, Cardinal *));
static void nhFreePixel(XtAppContext, XrmValuePtr, XtPointer, XrmValuePtr,
Cardinal *);
#endif
static boolean FDECL(new_resource_macro, (String, unsigned));
static void NDECL(load_default_resources);
static void NDECL(release_default_resources);
static int FDECL(panic_on_error, (Display *, XErrorEvent *));
static boolean new_resource_macro(String, unsigned);
static void load_default_resources(void);
static void release_default_resources(void);
static int panic_on_error(Display *, XErrorEvent *);
#ifdef X11_HANGUP_SIGNAL
static void FDECL(X11_sig, (int));
static void FDECL(X11_sig_cb, (XtPointer, XtSignalId *));
static void X11_sig(int);
static void X11_sig_cb(XtPointer, XtSignalId *);
#endif
static void FDECL(d_timeout, (XtPointer, XtIntervalId *));
static void FDECL(X11_hangup, (Widget, XEvent *, String *, Cardinal *));
static void FDECL(X11_bail, (const char *));
static void FDECL(askname_delete, (Widget, XEvent *, String *, Cardinal *));
static void FDECL(askname_done, (Widget, XtPointer, XtPointer));
static void FDECL(done_button, (Widget, XtPointer, XtPointer));
static void FDECL(getline_delete, (Widget, XEvent *, String *, Cardinal *));
static void FDECL(abort_button, (Widget, XtPointer, XtPointer));
static void NDECL(release_getline_widgets);
static void FDECL(yn_delete, (Widget, XEvent *, String *, Cardinal *));
static void FDECL(yn_key, (Widget, XEvent *, String *, Cardinal *));
static void NDECL(release_yn_widgets);
static int FDECL(input_event, (int));
static void FDECL(win_visible, (Widget, XtPointer, XEvent *, Boolean *));
static void NDECL(init_standard_windows);
static void d_timeout(XtPointer, XtIntervalId *);
static void X11_hangup(Widget, XEvent *, String *, Cardinal *);
static void X11_bail(const char *);
static void askname_delete(Widget, XEvent *, String *, Cardinal *);
static void askname_done(Widget, XtPointer, XtPointer);
static void done_button(Widget, XtPointer, XtPointer);
static void getline_delete(Widget, XEvent *, String *, Cardinal *);
static void abort_button(Widget, XtPointer, XtPointer);
static void release_getline_widgets(void);
static void yn_delete(Widget, XEvent *, String *, Cardinal *);
static void yn_key(Widget, XEvent *, String *, Cardinal *);
static void release_yn_widgets(void);
static int input_event(int);
static void win_visible(Widget, XtPointer, XEvent *, Boolean *);
static void init_standard_windows(void);
/*
* Local variables.
@@ -182,9 +182,7 @@ static winid message_win = WIN_ERR, /* These are the winids of the message, */
static Pixmap icon_pixmap = None; /* Pixmap for icon. */
void
X11_putmsghistory(msg, is_restoring)
const char *msg;
boolean is_restoring;
X11_putmsghistory(const char *msg, boolean is_restoring)
{
if (WIN_MESSAGE != WIN_ERR) {
struct xwindow *wp = &window_list[WIN_MESSAGE];
@@ -195,8 +193,7 @@ boolean is_restoring;
}
char *
X11_getmsghistory(init)
boolean init;
X11_getmsghistory(boolean init)
{
if (WIN_MESSAGE != WIN_ERR) {
static struct line_element *curr = (struct line_element *) 0;
@@ -226,8 +223,7 @@ boolean init;
* that this is not the popup widget, nor the viewport, but the child.
*/
struct xwindow *
find_widget(w)
Widget w;
find_widget(Widget w)
{
int windex;
struct xwindow *wp;
@@ -251,7 +247,7 @@ Widget w;
* Find a free window slot for use.
*/
static winid
find_free_window()
find_free_window(void)
{
int windex;
struct xwindow *wp;
@@ -268,9 +264,7 @@ find_free_window()
XColor
get_nhcolor(wp, clr)
struct xwindow *wp;
int clr;
get_nhcolor(struct xwindow *wp, int clr)
{
init_menu_nhcolors(wp);
/* FIXME: init_menu_nhcolors may fail */
@@ -282,8 +276,7 @@ int clr;
}
void
init_menu_nhcolors(wp)
struct xwindow *wp;
init_menu_nhcolors(struct xwindow *wp)
{
static const char *mapCLR_to_res[CLR_MAX] = {
XtNblack,
@@ -400,11 +393,10 @@ XtConvertArgRec const nhcolorConvertArgs[] = {
* Return True if something close was found.
*/
Boolean
nhApproxColor(screen, colormap, str, color)
Screen *screen; /* screen to use */
Colormap colormap; /* the colormap to use */
char *str; /* color name */
XColor *color; /* the X color structure; changed only if successful */
nhApproxColor(Screen *screen, /* screen to use */
Colormap colormap, /* the colormap to use */
char *str, /* color name */
XColor *color) /* the X color structure; changed only if successful */
{
int ncells;
long cdiff = 16777216; /* 2^24; hopefully our map is smaller */
@@ -476,13 +468,9 @@ try_again:
}
Boolean
nhCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret)
Display *dpy;
XrmValuePtr args;
Cardinal *num_args;
XrmValuePtr fromVal;
XrmValuePtr toVal;
XtPointer *closure_ret;
nhCvtStringToPixel(Display *dpy, XrmValuePtr args, Cardinal *num_args,
XrmValuePtr fromVal, XrmValuePtr toVal,
XtPointer *closure_ret)
{
String str = (String) fromVal->addr;
XColor screenColor;
@@ -571,9 +559,7 @@ XtPointer *closure_ret;
/* Ask the WM for window frame size */
void
get_window_frame_extents(w, top, bottom, left, right)
Widget w;
long *top, *bottom, *left, *right;
get_window_frame_extents(Widget w, long *top, long *bottom, long *left, long *right)
{
XEvent event;
Display *dpy = XtDisplay(w);
@@ -605,9 +591,7 @@ long *top, *bottom, *left, *right;
}
void
get_widget_window_geometry(w, x,y, width, height)
Widget w;
int *x, *y, *width, *height;
get_widget_window_geometry(Widget w, int *x, int *y, int *width, int *height)
{
long top, bottom, left, right;
Arg args[5];
@@ -623,8 +607,7 @@ int *x, *y, *width, *height;
/* Change the full font name string so the weight is "bold" */
char *
fontname_boldify(fontname)
const char *fontname;
fontname_boldify(const char *fontname)
{
static char buf[BUFSZ];
char *bufp = buf;
@@ -650,9 +633,7 @@ const char *fontname;
}
void
load_boldfont(wp, w)
struct xwindow *wp;
Widget w;
load_boldfont(struct xwindow *wp, Widget w)
{
Arg args[1];
XFontStruct *fs;
@@ -677,12 +658,11 @@ Widget w;
#ifdef TEXTCOLOR
/* ARGSUSED */
static void
nhFreePixel(app, toVal, closure, args, num_args)
XtAppContext app;
XrmValuePtr toVal;
XtPointer closure;
XrmValuePtr args;
Cardinal *num_args;
nhFreePixel(XtAppContext app,
XrmValuePtr toVal,
XtPointer closure,
XrmValuePtr args,
Cardinal *num_args)
{
Screen *screen;
Colormap colormap;
@@ -708,8 +688,7 @@ Cardinal *num_args;
* assumption of ascent + descent is not always valid.
*/
Dimension
nhFontHeight(w)
Widget w;
nhFontHeight(Widget w)
{
#ifdef _XawTextSink_h
Widget sink;
@@ -740,9 +719,8 @@ static String *default_resource_data = 0, /* NULL-terminated arrays */
/* caller found "#define"; parse into macro name and its expansion value */
static boolean
new_resource_macro(inbuf, numdefs)
String inbuf; /* points past '#define' rather than to start of buffer */
unsigned numdefs; /* array slot to fill */
new_resource_macro(String inbuf, /* points past '#define' rather than to start of buffer */
unsigned numdefs) /* array slot to fill */
{
String p, q;
@@ -775,7 +753,7 @@ unsigned numdefs; /* array slot to fill */
/* read the template NetHack.ad into default_resource_data[] to supply
fallback resources to XtAppInitialize() */
static void
load_default_resources()
load_default_resources(void)
{
FILE *fp;
String inbuf;
@@ -884,7 +862,7 @@ load_default_resources()
}
static void
release_default_resources()
release_default_resources(void)
{
if (default_resource_data) {
unsigned idx;
@@ -898,23 +876,19 @@ release_default_resources()
/* Global Functions ======================================================= */
void
X11_raw_print(str)
const char *str;
X11_raw_print(const char *str)
{
(void) puts(str);
}
void
X11_raw_print_bold(str)
const char *str;
X11_raw_print_bold(const char *str)
{
(void) puts(str);
}
void
X11_curs(window, x, y)
winid window;
int x, y;
X11_curs(winid window, int x, int y)
{
check_winid(window);
@@ -932,10 +906,7 @@ int x, y;
}
void
X11_putstr(window, attr, str)
winid window;
int attr;
const char *str;
X11_putstr(winid window, int attr, const char *str)
{
winid new_win;
struct xwindow *wp;
@@ -982,20 +953,19 @@ const char *str;
/* We do event processing as a callback, so this is a null routine. */
void
X11_get_nh_event()
X11_get_nh_event(void)
{
return;
}
int
X11_nhgetch()
X11_nhgetch(void)
{
return input_event(EXIT_ON_KEY_PRESS);
}
int
X11_nh_poskey(x, y, mod)
int *x, *y, *mod;
X11_nh_poskey(int *x, int *y, int *mod)
{
int val = input_event(EXIT_ON_KEY_OR_BUTTON_PRESS);
@@ -1008,8 +978,7 @@ int *x, *y, *mod;
}
winid
X11_create_nhwindow(type)
int type;
X11_create_nhwindow(int type)
{
winid window;
struct xwindow *wp;
@@ -1103,8 +1072,7 @@ int type;
}
void
X11_clear_nhwindow(window)
winid window;
X11_clear_nhwindow(winid window)
{
struct xwindow *wp;
@@ -1130,9 +1098,7 @@ winid window;
}
void
X11_display_nhwindow(window, blocking)
winid window;
boolean blocking;
X11_display_nhwindow(winid window, boolean blocking)
{
struct xwindow *wp;
@@ -1194,8 +1160,7 @@ boolean blocking;
}
void
X11_destroy_nhwindow(window)
winid window;
X11_destroy_nhwindow(winid window)
{
struct xwindow *wp;
@@ -1256,7 +1221,7 @@ winid window;
}
void
X11_update_inventory()
X11_update_inventory(void)
{
if (x_inited && window_list[WIN_INVEN].menu_information->is_up) {
updated_inventory = 1; /* hack to avoid mapping&raising window */
@@ -1267,13 +1232,13 @@ X11_update_inventory()
/* The current implementation has all of the saved lines on the screen. */
int
X11_doprev_message()
X11_doprev_message(void)
{
return 0;
}
void
X11_nhbell()
X11_nhbell(void)
{
/* We can't use XBell until toplevel has been initialized. */
if (x_inited)
@@ -1282,7 +1247,7 @@ X11_nhbell()
}
void
X11_mark_synch()
X11_mark_synch(void)
{
if (x_inited) {
/*
@@ -1299,7 +1264,7 @@ X11_mark_synch()
}
void
X11_wait_synch()
X11_wait_synch(void)
{
if (x_inited)
XFlush(XtDisplay(toplevel));
@@ -1307,14 +1272,13 @@ X11_wait_synch()
/* Both resume_ and suspend_ are called from ioctl.c and unixunix.c. */
void
X11_resume_nhwindows()
X11_resume_nhwindows(void)
{
return;
}
/* ARGSUSED */
void
X11_suspend_nhwindows(str)
const char *str;
X11_suspend_nhwindows(const char *str)
{
nhUse(str);
@@ -1324,8 +1288,7 @@ const char *str;
/* Under X, we don't need to initialize the number pad. */
/* ARGSUSED */
void
X11_number_pad(state) /* called from options.c */
int state;
X11_number_pad(int state) /* called from options.c */
{
nhUse(state);
@@ -1334,24 +1297,21 @@ int state;
/* called from setftty() in unixtty.c */
void
X11_start_screen()
X11_start_screen(void)
{
return;
}
/* called from settty() in unixtty.c */
void
X11_end_screen()
X11_end_screen(void)
{
return;
}
#ifdef GRAPHIC_TOMBSTONE
void
X11_outrip(window, how, when)
winid window;
int how;
time_t when;
X11_outrip(winid window, int how, time_t when)
{
struct xwindow *wp;
FILE *rip_fp = 0;
@@ -1465,9 +1425,7 @@ static XtResource resources[] = {
};
static int
panic_on_error(display, error)
Display *display;
XErrorEvent *error;
panic_on_error(Display *display, XErrorEvent *error)
{
char buf[BUFSZ];
XGetErrorText(display, error->error_code, buf, BUFSZ);
@@ -1480,9 +1438,7 @@ XErrorEvent *error;
}
void
X11_init_nhwindows(argcp, argv)
int *argcp;
char **argv;
X11_init_nhwindows(int *argcp, char **argv)
{
int i;
Cardinal num_args;
@@ -1585,8 +1541,7 @@ char **argv;
*/
/* ARGSUSED */
void
X11_exit_nhwindows(dummy)
const char *dummy;
X11_exit_nhwindows(const char *dummy)
{
extern Pixmap tile_pixmap; /* from winmap.c */
@@ -1616,17 +1571,14 @@ const char *dummy;
#ifdef X11_HANGUP_SIGNAL
static void
X11_sig(sig) /* Unix signal handler */
int sig;
X11_sig(int sig) /* Unix signal handler */
{
XtNoticeSignal(X11_sig_id);
hangup(sig);
}
static void
X11_sig_cb(not_used, id)
XtPointer not_used;
XtSignalId *id;
X11_sig_cb(XtPointer not_used, XtSignalId *id)
{
XEvent event;
XClientMessageEvent *mesg;
@@ -1654,9 +1606,7 @@ XtSignalId *id;
*/
/* ARGSUSED */
static void
d_timeout(client_data, id)
XtPointer client_data;
XtIntervalId *id;
d_timeout(XtPointer client_data, XtIntervalId *id)
{
XEvent event;
XClientMessageEvent *mesg;
@@ -1681,7 +1631,7 @@ XtIntervalId *id;
* for a sent event.
*/
void
X11_delay_output()
X11_delay_output(void)
{
if (!x_inited)
return;
@@ -1695,11 +1645,7 @@ X11_delay_output()
/* X11_hangup ------------------------------------------------------------- */
/* ARGSUSED */
static void
X11_hangup(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
X11_hangup(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
nhUse(w);
nhUse(event);
@@ -1713,8 +1659,7 @@ Cardinal *num_params;
/* X11_bail --------------------------------------------------------------- */
/* clean up and quit */
static void
X11_bail(mesg)
const char *mesg;
X11_bail(const char *mesg)
{
g.program_state.something_worth_saving = 0;
clearlocks();
@@ -1726,11 +1671,7 @@ const char *mesg;
/* askname ---------------------------------------------------------------- */
/* ARGSUSED */
static void
askname_delete(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
askname_delete(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
nhUse(event);
nhUse(params);
@@ -1744,10 +1685,7 @@ Cardinal *num_params;
/* Callback for askname dialog widget. */
/* ARGSUSED */
static void
askname_done(w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
askname_done(Widget w, XtPointer client_data, XtPointer call_data)
{
unsigned len;
char *s;
@@ -1779,7 +1717,7 @@ XtPointer call_data;
/* ask player for character's name to replace generic name "player" (or other
values; see config.h) after 'nethack -u player' or OPTIONS=name:player */
void
X11_askname()
X11_askname(void)
{
Widget popup, dialog;
Arg args[1];
@@ -1847,10 +1785,7 @@ static char *getline_input;
/* Callback for getline dialog widget. */
/* ARGSUSED */
static void
done_button(w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
done_button(Widget w, XtPointer client_data, XtPointer call_data)
{
int len;
char *s;
@@ -1876,11 +1811,7 @@ XtPointer call_data;
/* ARGSUSED */
static void
getline_delete(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
getline_delete(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
nhUse(event);
nhUse(params);
@@ -1894,10 +1825,7 @@ Cardinal *num_params;
/* Callback for getline dialog widget. */
/* ARGSUSED */
static void
abort_button(w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
abort_button(Widget w, XtPointer client_data, XtPointer call_data)
{
Widget dialog = (Widget) client_data;
@@ -1910,7 +1838,7 @@ XtPointer call_data;
}
static void
release_getline_widgets()
release_getline_widgets(void)
{
if (getline_dialog)
XtDestroyWidget(getline_dialog), getline_dialog = (Widget) 0;
@@ -1919,9 +1847,7 @@ release_getline_widgets()
}
void
X11_getlin(question, input)
const char *question;
char *input;
X11_getlin(const char *question, char *input)
{
getline_input = input;
@@ -1970,9 +1896,7 @@ char *input;
/* uses a menu (with no selectors specified) rather than a text window
to allow previous_page and first_menu actions to move backwards */
void
X11_display_file(str, complain)
const char *str;
boolean complain;
X11_display_file(const char *str, boolean complain)
{
dlb *fp;
winid newwin;
@@ -2035,8 +1959,7 @@ static const char yn_translations[] = "#override\n\
* no conversion (i.e. just the CTRL key hit) a NUL is returned.
*/
char
key_event_to_char(key)
XKeyEvent *key;
key_event_to_char(XKeyEvent *key)
{
char keystring[MAX_KEY_STRING];
int nbytes;
@@ -2057,11 +1980,7 @@ XKeyEvent *key;
*/
/* ARGSUSED */
static void
yn_delete(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
yn_delete(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
nhUse(w);
nhUse(event);
@@ -2079,11 +1998,7 @@ Cardinal *num_params;
*/
/* ARGSUSED */
static void
yn_key(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
yn_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
char ch;
@@ -2151,7 +2066,7 @@ Cardinal *num_params;
/* called at exit time */
static void
release_yn_widgets()
release_yn_widgets(void)
{
if (yn_label)
XtDestroyWidget(yn_label), yn_label = (Widget) 0;
@@ -2162,10 +2077,9 @@ release_yn_widgets()
/* 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' */
char
X11_yn_function(ques, choices, def)
const char *ques;
const char *choices; /* string of possible response chars; any char if Null */
char def; /* default response if user hits <space> or <return> */
X11_yn_function(const char *ques,
const char *choices, /* string of possible response chars; any char if Null */
char def) /* default response if user hits <space> or <return> */
{
char buf[BUFSZ];
Arg args[4];
@@ -2305,8 +2219,7 @@ char def; /* default response if user hits <space> or <return> */
/* used when processing window-capability-specific run-time options;
we support toggling tiles on and off via iflags.wc_tiled_map */
void
X11_preference_update(pref)
const char *pref;
X11_preference_update(const char *pref)
{
if (!strcmp(pref, "tiled_map")) {
if (WIN_MAP != WIN_ERR)
@@ -2321,8 +2234,7 @@ const char *pref;
* do some pre-processing.
*/
static int
input_event(exit_condition)
int exit_condition;
input_event(int exit_condition)
{
if (appResources.fancy_status && WIN_STATUS != WIN_ERR)
check_turn_events(); /* hilighting on the fancy status window */
@@ -2336,10 +2248,7 @@ int exit_condition;
/*ARGSUSED*/
void
msgkey(w, data, event)
Widget w;
XtPointer data;
XEvent *event;
msgkey(Widget w, XtPointer data, XEvent *event)
{
Cardinal num = 0;
@@ -2352,11 +2261,9 @@ XEvent *event;
/* only called for autofocus */
/*ARGSUSED*/
static void
win_visible(w, data, event, flag)
Widget w;
XtPointer data; /* client_data not used */
XEvent *event;
Boolean *flag; /* continue_to_dispatch flag not used */
win_visible(Widget w, XtPointer data, /* client_data not used */
XEvent *event,
Boolean *flag) /* continue_to_dispatch flag not used */
{
XVisibilityEvent *vis_event = (XVisibilityEvent *) event;
@@ -2376,8 +2283,7 @@ Boolean *flag; /* continue_to_dispatch flag not used */
part of the map when idle or to invert background and foreground when
a prompt is active */
void
highlight_yn(init)
boolean init;
highlight_yn(boolean init)
{
struct xwindow *xmap;
@@ -2416,7 +2322,7 @@ boolean init;
* than using a popup.
*/
static void
init_standard_windows()
init_standard_windows(void)
{
Widget form, message_viewport, map_viewport, status;
Arg args[8];
@@ -2616,10 +2522,9 @@ init_standard_windows()
}
void
nh_XtPopup(w, grb, childwid)
Widget w; /* widget */
int grb; /* type of grab */
Widget childwid; /* child to receive focus (can be None) */
nh_XtPopup(Widget w, /* widget */
int grb, /* type of grab */
Widget childwid) /* child to receive focus (can be None) */
{
XtPopup(w, (XtGrabKind) grb);
XSetWMProtocols(XtDisplay(w), XtWindow(w), &wm_delete_window, 1);
@@ -2628,8 +2533,7 @@ Widget childwid; /* child to receive focus (can be None) */
}
void
nh_XtPopdown(w)
Widget w;
nh_XtPopdown(Widget w)
{
XtPopdown(w);
if (appResources.autofocus)
@@ -2637,8 +2541,7 @@ Widget w;
}
void
win_X11_init(dir)
int dir;
win_X11_init(int dir)
{
if (dir != WININIT)
return;
@@ -2647,9 +2550,7 @@ int dir;
}
void
find_scrollbars(w, horiz, vert)
Widget w;
Widget *horiz, *vert;
find_scrollbars(Widget w, Widget *horiz, Widget *vert)
{
if (w) {
do {
@@ -2665,11 +2566,8 @@ Widget *horiz, *vert;
*/
/*ARGSUSED*/
void
nh_keyscroll(viewport, event, params, num_params)
Widget viewport;
XEvent *event;
String *params;
Cardinal *num_params;
nh_keyscroll(Widget viewport, XEvent *event, String *params,
Cardinal *num_params)
{
Arg arg[2];
Widget horiz_sb = (Widget) 0, vert_sb = (Widget) 0;
+40 -83
View File
@@ -57,27 +57,23 @@ extern int total_tiles_used;
#define COL0_OFFSET 1 /* change to 0 to revert to displaying unused column 0 */
static boolean FDECL(init_tiles, (struct xwindow *));
static void FDECL(set_button_values, (Widget, int, int, unsigned));
static void FDECL(map_check_size_change, (struct xwindow *));
static void FDECL(map_update, (struct xwindow *, int, int, int, int,
BOOLEAN_P));
static void FDECL(init_text, (struct xwindow *));
static void FDECL(map_exposed, (Widget, XtPointer, XtPointer));
static void FDECL(set_gc, (Widget, Font, const char *, Pixel, GC *, GC *));
static void FDECL(get_text_gc, (struct xwindow *, Font));
static void FDECL(map_all_unexplored, (struct map_info_t *));
static void FDECL(get_char_info, (struct xwindow *));
static void FDECL(display_cursor, (struct xwindow *));
static boolean init_tiles(struct xwindow *);
static void set_button_values(Widget, int, int, unsigned);
static void map_check_size_change(struct xwindow *);
static void map_update(struct xwindow *, int, int, int, int, boolean);
static void init_text(struct xwindow *);
static void map_exposed(Widget, XtPointer, XtPointer);
static void set_gc(Widget, Font, const char *, Pixel, GC *, GC *);
static void get_text_gc(struct xwindow *, Font);
static void map_all_unexplored(struct map_info_t *);
static void get_char_info(struct xwindow *);
static void display_cursor(struct xwindow *);
/* Global functions ======================================================= */
void
X11_print_glyph(window, x, y, glyphinfo, bkglyphinfo)
winid window;
xchar x, y;
const glyph_info *glyphinfo;
const glyph_info *bkglyphinfo UNUSED;
X11_print_glyph(winid window, xchar x, xchar y, const glyph_info *glyphinfo,
const glyph_info *bkglyphinfo UNUSED)
{
struct map_info_t *map_info;
boolean update_bbox = FALSE;
@@ -156,9 +152,7 @@ const glyph_info *bkglyphinfo UNUSED;
*/
/*ARGSUSED*/
void
X11_cliparound(x, y)
int x UNUSED;
int y UNUSED;
X11_cliparound(int x UNUSED, int y UNUSED)
{
return;
}
@@ -194,10 +188,7 @@ static struct tile_annotation pet_annotation;
static struct tile_annotation pile_annotation;
static void
init_annotation(annotation, filename, colorpixel)
struct tile_annotation *annotation;
char *filename;
Pixel colorpixel;
init_annotation(struct tile_annotation *annotation, char *filename, Pixel colorpixel)
{
Display *dpy = XtDisplay(toplevel);
@@ -224,7 +215,7 @@ Pixel colorpixel;
* map viewport.
*/
void
post_process_tiles()
post_process_tiles(void)
{
Display *dpy = XtDisplay(toplevel);
unsigned int width, height;
@@ -261,8 +252,7 @@ post_process_tiles()
* Return FALSE otherwise.
*/
static boolean
init_tiles(wp)
struct xwindow *wp;
init_tiles(struct xwindow *wp)
{
#ifdef USE_XPM
XpmAttributes attributes;
@@ -578,8 +568,7 @@ ntiles %ld\n",
* Make sure the map's cursor is always visible.
*/
void
check_cursor_visibility(wp)
struct xwindow *wp;
check_cursor_visibility(struct xwindow *wp)
{
Arg arg[2];
Widget viewport, horiz_sb, vert_sb;
@@ -730,8 +719,7 @@ struct xwindow *wp;
* on the screen when the user resizes the nethack window.
*/
static void
map_check_size_change(wp)
struct xwindow *wp;
map_check_size_change(struct xwindow *wp)
{
struct map_info_t *map_info = wp->map_information;
Arg arg[2];
@@ -785,12 +773,8 @@ struct xwindow *wp;
* by querying the widget with the resource name.
*/
static void
set_gc(w, font, resource_name, bgpixel, regular, inverse)
Widget w;
Font font;
const char *resource_name;
Pixel bgpixel;
GC *regular, *inverse;
set_gc(Widget w, Font font, const char *resource_name, Pixel bgpixel,
GC *regular, GC *inverse)
{
XGCValues values;
XtGCMask mask = GCFunction | GCForeground | GCBackground | GCFont;
@@ -820,9 +804,7 @@ GC *regular, *inverse;
* background colors on the current GC as needed.
*/
static void
get_text_gc(wp, font)
struct xwindow *wp;
Font font;
get_text_gc(struct xwindow *wp, Font font)
{
struct map_info_t *map_info = wp->map_information;
Pixel bgpixel;
@@ -865,8 +847,7 @@ Font font;
* Display the cursor on the map window.
*/
static void
display_cursor(wp)
struct xwindow *wp;
display_cursor(struct xwindow *wp)
{
/* Redisplay the cursor location inverted. */
map_update(wp, wp->cursy, wp->cursy, wp->cursx, wp->cursx, TRUE);
@@ -877,8 +858,7 @@ struct xwindow *wp;
* the screen.
*/
void
display_map_window(wp)
struct xwindow *wp;
display_map_window(struct xwindow *wp)
{
register int row;
struct map_info_t *map_info = wp->map_information;
@@ -927,8 +907,7 @@ struct xwindow *wp;
* (Actually, column 0 is set to S_nothing and 1..COLNO-1 to S_unexplored.)
*/
static void
map_all_unexplored(map_info) /* [was map_all_stone()] */
struct map_info_t *map_info;
map_all_unexplored(struct map_info_t *map_info) /* [was map_all_stone()] */
{
int x, y;
/* unsigned short g_stone = cmap_to_glyph(S_stone); */
@@ -963,8 +942,7 @@ struct map_info_t *map_info;
* display_map_window().
*/
void
clear_map_window(wp)
struct xwindow *wp;
clear_map_window(struct xwindow *wp)
{
struct map_info_t *map_info = wp->map_information;
@@ -985,8 +963,7 @@ struct xwindow *wp;
* that are used when updating it.
*/
static void
get_char_info(wp)
struct xwindow *wp;
get_char_info(struct xwindow *wp)
{
XFontStruct *fs;
struct map_info_t *map_info = wp->map_information;
@@ -1033,11 +1010,7 @@ static int inptr = 0; /* points to valid data */
* Keyboard and button event handler for map window.
*/
void
map_input(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
map_input(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
XKeyEvent *key;
XButtonEvent *button;
@@ -1133,11 +1106,7 @@ Cardinal *num_params;
}
static void
set_button_values(w, x, y, button)
Widget w;
int x;
int y;
unsigned int button;
set_button_values(Widget w, int x, int y, unsigned int button)
{
struct xwindow *wp;
struct map_info_t *map_info;
@@ -1170,10 +1139,8 @@ unsigned int button;
*/
/*ARGSUSED*/
static void
map_exposed(w, client_data, widget_data)
Widget w;
XtPointer client_data; /* unused */
XtPointer widget_data; /* expose event from Window widget */
map_exposed(Widget w, XtPointer client_data, /* unused */
XtPointer widget_data) /* expose event from Window widget */
{
int x, y;
struct xwindow *wp;
@@ -1256,10 +1223,7 @@ XtPointer widget_data; /* expose event from Window widget */
* The start and stop columns are *inclusive*.
*/
static void
map_update(wp, start_row, stop_row, start_col, stop_col, inverted)
struct xwindow *wp;
int start_row, stop_row, start_col, stop_col;
boolean inverted;
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;
@@ -1433,9 +1397,7 @@ boolean inverted;
/* Adjust the number of rows and columns on the given map window */
void
set_map_size(wp, cols, rows)
struct xwindow *wp;
Dimension cols, rows;
set_map_size(struct xwindow *wp, Dimension cols, Dimension rows)
{
Arg args[4];
Cardinal num_args;
@@ -1456,8 +1418,7 @@ Dimension cols, rows;
}
static void
init_text(wp)
struct xwindow *wp;
init_text(struct xwindow *wp)
{
struct map_info_t *map_info = wp->map_information;
@@ -1480,10 +1441,9 @@ static char map_translations[] = "#override\n\
* The map window creation routine.
*/
void
create_map_window(wp, create_popup, parent)
struct xwindow *wp;
boolean create_popup; /* parent is a popup shell that we create */
Widget parent;
create_map_window(struct xwindow *wp,
boolean create_popup, /* parent is a popup shell that we create */
Widget parent)
{
struct map_info_t *map_info; /* map info pointer */
Widget map, viewport;
@@ -1610,8 +1570,7 @@ Widget parent;
* Destroy this map window.
*/
void
destroy_map_window(wp)
struct xwindow *wp;
destroy_map_window(struct xwindow *wp)
{
struct map_info_t *map_info = wp->map_information;
@@ -1659,8 +1618,7 @@ boolean exit_x_event; /* exit condition for the event loop */
#if 0 /*******/
void
pkey(k)
int k;
pkey(int k)
{
printf("key = '%s%c'\n", (k < 32) ? "^" : "", (k < 32) ? '@' + k : k);
}
@@ -1671,8 +1629,7 @@ int k;
* under certain circumstances.
*/
int
x_event(exit_condition)
int exit_condition;
x_event(int exit_condition)
{
XEvent event;
int retval = 0;
+70 -128
View File
@@ -35,34 +35,34 @@
#include "hack.h"
#include "winX.h"
static void FDECL(menu_size_change_handler, (Widget, XtPointer,
XEvent *, Boolean *));
static void FDECL(menu_select, (Widget, XtPointer, XtPointer));
static void FDECL(invert_line, (struct xwindow *, x11_menu_item *, int, long));
static void FDECL(menu_ok, (Widget, XtPointer, XtPointer));
static void FDECL(menu_cancel, (Widget, XtPointer, XtPointer));
static void FDECL(menu_all, (Widget, XtPointer, XtPointer));
static void FDECL(menu_none, (Widget, XtPointer, XtPointer));
static void FDECL(menu_invert, (Widget, XtPointer, XtPointer));
static void FDECL(menu_search, (Widget, XtPointer, XtPointer));
static void FDECL(search_menu, (struct xwindow *));
static void FDECL(select_all, (struct xwindow *));
static void FDECL(select_none, (struct xwindow *));
static void FDECL(select_match, (struct xwindow *, char *));
static void FDECL(invert_all, (struct xwindow *));
static void FDECL(invert_match, (struct xwindow *, char *));
static void FDECL(menu_popdown, (struct xwindow *));
static Widget FDECL(menu_create_buttons, (struct xwindow *, Widget, Widget));
static void FDECL(menu_create_entries, (struct xwindow *, struct menu *));
static void FDECL(destroy_menu_entry_widgets, (struct xwindow *));
static void NDECL(create_menu_translation_tables);
static void menu_size_change_handler(Widget, XtPointer, XEvent *,
Boolean *);
static void menu_select(Widget, XtPointer, XtPointer);
static void invert_line(struct xwindow *, x11_menu_item *, int, long);
static void menu_ok(Widget, XtPointer, XtPointer);
static void menu_cancel(Widget, XtPointer, XtPointer);
static void menu_all(Widget, XtPointer, XtPointer);
static void menu_none(Widget, XtPointer, XtPointer);
static void menu_invert(Widget, XtPointer, XtPointer);
static void menu_search(Widget, XtPointer, XtPointer);
static void search_menu(struct xwindow *);
static void select_all(struct xwindow *);
static void select_none(struct xwindow *);
static void select_match(struct xwindow *, char *);
static void invert_all(struct xwindow *);
static void invert_match(struct xwindow *, char *);
static void menu_popdown(struct xwindow *);
static Widget menu_create_buttons(struct xwindow *, Widget, Widget);
static void menu_create_entries(struct xwindow *, struct menu *);
static void destroy_menu_entry_widgets(struct xwindow *);
static void create_menu_translation_tables(void);
static void FDECL(move_menu, (struct menu *, struct menu *));
static void FDECL(free_menu_line_entries, (struct menu *));
static void FDECL(free_menu, (struct menu *));
static void FDECL(reset_menu_to_default, (struct menu *));
static void FDECL(clear_old_menu, (struct xwindow *));
static char *FDECL(copy_of, (const char *));
static void move_menu(struct menu *, struct menu *);
static void free_menu_line_entries(struct menu *);
static void free_menu(struct menu *);
static void reset_menu_to_default(struct menu *);
static void clear_old_menu(struct xwindow *);
static char *copy_of(const char *);
#define reset_menu_count(mi) ((mi)->counting = FALSE, (mi)->menu_count = 0L)
@@ -84,7 +84,7 @@ XtTranslations menu_translation_table = (XtTranslations) 0;
XtTranslations menu_del_translation_table = (XtTranslations) 0;
static void
create_menu_translation_tables()
create_menu_translation_tables(void)
{
if (!menu_translation_table) {
menu_translation_table = XtParseTranslationTable(menu_translations);
@@ -97,11 +97,7 @@ create_menu_translation_tables()
/*ARGSUSED*/
static void
menu_size_change_handler(w, ptr, event, flag)
Widget w;
XtPointer ptr;
XEvent *event;
Boolean *flag;
menu_size_change_handler(Widget w, XtPointer ptr, XEvent *event, Boolean *flag)
{
struct xwindow *wp = (struct xwindow *) ptr;
@@ -127,9 +123,7 @@ Boolean *flag;
*/
/* ARGSUSED */
static void
menu_select(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
menu_select(Widget w, XtPointer client_data, XtPointer call_data)
{
struct menu_info_t *menu_info;
long how_many;
@@ -178,11 +172,7 @@ XtPointer client_data, call_data;
*/
/* ARGSUSED */
void
menu_delete(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
menu_delete(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
nhUse(event);
nhUse(params);
@@ -196,11 +186,7 @@ Cardinal *num_params;
*/
/*ARGSUSED*/
static void
invert_line(wp, curr, which, how_many)
struct xwindow *wp;
x11_menu_item *curr;
int which;
long how_many;
invert_line(struct xwindow *wp, x11_menu_item *curr, int which, long how_many)
{
Arg args[2];
@@ -229,11 +215,7 @@ long how_many;
*/
/* ARGSUSED */
void
menu_key(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
menu_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
struct menu_info_t *menu_info;
x11_menu_item *curr;
@@ -382,9 +364,7 @@ menu_done:
/* ARGSUSED */
static void
menu_ok(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
menu_ok(Widget w, XtPointer client_data, XtPointer call_data)
{
struct xwindow *wp = (struct xwindow *) client_data;
@@ -396,9 +376,8 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
menu_cancel(w, client_data, call_data)
Widget w; /* don't use - may be None */
XtPointer client_data, call_data;
menu_cancel(Widget w, /* don't use - may be None */
XtPointer client_data, XtPointer call_data)
{
struct xwindow *wp = (struct xwindow *) client_data;
@@ -414,9 +393,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
menu_all(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
menu_all(Widget w, XtPointer client_data, XtPointer call_data)
{
nhUse(w);
nhUse(call_data);
@@ -426,9 +403,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
menu_none(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
menu_none(Widget w, XtPointer client_data, XtPointer call_data)
{
nhUse(w);
nhUse(call_data);
@@ -438,9 +413,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
menu_invert(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
menu_invert(Widget w, XtPointer client_data, XtPointer call_data)
{
nhUse(w);
nhUse(call_data);
@@ -450,9 +423,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
menu_search(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
menu_search(Widget w, XtPointer client_data, XtPointer call_data)
{
struct xwindow *wp = (struct xwindow *) client_data;
struct menu_info_t *menu_info = wp->menu_information;
@@ -467,8 +438,7 @@ XtPointer client_data, call_data;
/* common to menu_search and menu_key */
static void
search_menu(wp)
struct xwindow *wp;
search_menu(struct xwindow *wp)
{
char *pat, buf[BUFSZ + 2]; /* room for '*' + BUFSZ-1 + '*' + '\0' */
struct menu_info_t *menu_info = wp->menu_information;
@@ -500,8 +470,7 @@ struct xwindow *wp;
}
static void
select_all(wp)
struct xwindow *wp;
select_all(struct xwindow *wp)
{
x11_menu_item *curr;
int count;
@@ -517,8 +486,7 @@ struct xwindow *wp;
}
static void
select_none(wp)
struct xwindow *wp;
select_none(struct xwindow *wp)
{
x11_menu_item *curr;
int count;
@@ -534,8 +502,7 @@ struct xwindow *wp;
}
static void
invert_all(wp)
struct xwindow *wp;
invert_all(struct xwindow *wp)
{
x11_menu_item *curr;
int count;
@@ -551,9 +518,8 @@ struct xwindow *wp;
}
static void
invert_match(wp, match)
struct xwindow *wp;
char *match; /* wildcard pattern for pmatch() */
invert_match(struct xwindow *wp,
char *match) /* wildcard pattern for pmatch() */
{
x11_menu_item *curr;
int count;
@@ -571,9 +537,8 @@ char *match; /* wildcard pattern for pmatch() */
}
static void
select_match(wp, match)
struct xwindow *wp;
char *match; /* wildcard pattern for pmatch() */
select_match(struct xwindow *wp,
char *match) /* wildcard pattern for pmatch() */
{
x11_menu_item *curr, *found = 0;
int count;
@@ -598,8 +563,7 @@ char *match; /* wildcard pattern for pmatch() */
}
static void
menu_popdown(wp)
struct xwindow *wp;
menu_popdown(struct xwindow *wp)
{
nh_XtPopdown(wp->popup); /* remove the event grab */
XtDestroyWidget(wp->popup);
@@ -612,9 +576,7 @@ struct xwindow *wp;
/* Global functions ======================================================= */
void
X11_start_menu(window, mbehavior)
winid window;
unsigned long mbehavior UNUSED;
X11_start_menu(winid window, unsigned long mbehavior UNUSED)
{
struct xwindow *wp;
check_winid(window);
@@ -631,15 +593,13 @@ unsigned long mbehavior UNUSED;
/*ARGSUSED*/
void
X11_add_menu(window, glyphinfo, identifier, ch, gch, attr, str, itemflags)
winid window;
const glyph_info *glyphinfo UNUSED;
const anything *identifier;
char ch;
char gch; /* group accelerator (0 = no group) */
int attr;
const char *str;
unsigned itemflags;
X11_add_menu(winid window,
const glyph_info *glyphinfo UNUSED,
const anything *identifier,
char ch,
char gch, /* group accelerator (0 = no group) */
int attr,
const char *str, unsigned itemflags)
{
x11_menu_item *item;
struct menu_info_t *menu_info;
@@ -708,9 +668,7 @@ unsigned itemflags;
}
void
X11_end_menu(window, query)
winid window;
const char *query;
X11_end_menu(winid window, const char *query)
{
struct menu_info_t *menu_info;
@@ -725,10 +683,7 @@ const char *query;
}
int
X11_select_menu(window, how, menu_list)
winid window;
int how;
menu_item **menu_list;
X11_select_menu(winid window, int how, menu_item **menu_list)
{
x11_menu_item *curr;
struct xwindow *wp;
@@ -1001,8 +956,7 @@ menu_item **menu_list;
* zero length.
*/
static char *
copy_of(s)
const char *s;
copy_of(const char *s)
{
if (!s)
s = "";
@@ -1013,9 +967,7 @@ const char *s;
* Create ok, cancel, all, none, invert, and search buttons.
*/
static Widget
menu_create_buttons(wp, form, under)
struct xwindow *wp;
Widget form,under;
menu_create_buttons(struct xwindow *wp, Widget form, Widget under)
{
Arg args[15];
Cardinal num_args;
@@ -1137,9 +1089,7 @@ Widget form,under;
}
static void
menu_create_entries(wp, curr_menu)
struct xwindow *wp;
struct menu *curr_menu;
menu_create_entries(struct xwindow *wp, struct menu *curr_menu)
{
x11_menu_item *curr;
int menulineidx = 0;
@@ -1217,8 +1167,7 @@ struct menu *curr_menu;
}
static void
destroy_menu_entry_widgets(wp)
struct xwindow *wp;
destroy_menu_entry_widgets(struct xwindow *wp)
{
WidgetList wlist;
Cardinal numchild;
@@ -1242,8 +1191,7 @@ struct xwindow *wp;
}
static void
move_menu(src_menu, dest_menu)
struct menu *src_menu, *dest_menu;
move_menu(struct menu *src_menu, struct menu *dest_menu)
{
free_menu(dest_menu); /* toss old menu */
*dest_menu = *src_menu; /* make new menu current */
@@ -1252,8 +1200,7 @@ struct menu *src_menu, *dest_menu;
}
static void
free_menu_line_entries(mp)
struct menu *mp;
free_menu_line_entries(struct menu *mp)
{
/* We're not freeing menu entry widgets here, but let XtDestroyWidget()
on the parent widget take care of that */
@@ -1266,8 +1213,7 @@ struct menu *mp;
}
static void
free_menu(mp)
struct menu *mp;
free_menu(struct menu *mp)
{
free_menu_line_entries(mp);
if (mp->query)
@@ -1278,8 +1224,7 @@ struct menu *mp;
}
static void
reset_menu_to_default(mp)
struct menu *mp;
reset_menu_to_default(struct menu *mp)
{
mp->base = mp->last = (x11_menu_item *) 0;
mp->query = (const char *) 0;
@@ -1289,8 +1234,7 @@ struct menu *mp;
}
static void
clear_old_menu(wp)
struct xwindow *wp;
clear_old_menu(struct xwindow *wp)
{
struct menu_info_t *menu_info = wp->menu_information;
@@ -1306,8 +1250,7 @@ struct xwindow *wp;
}
void
create_menu_window(wp)
struct xwindow *wp;
create_menu_window(struct xwindow *wp)
{
wp->type = NHW_MENU;
wp->menu_information =
@@ -1325,8 +1268,7 @@ struct xwindow *wp;
}
void
destroy_menu_window(wp)
struct xwindow *wp;
destroy_menu_window(struct xwindow *wp)
{
clear_old_menu(wp); /* this will also destroy the widgets */
free((genericptr_t) wp->menu_information);
+29 -50
View File
@@ -35,15 +35,15 @@
#include "hack.h"
#include "winX.h"
static struct line_element *FDECL(get_previous, (struct line_element *));
static void FDECL(set_circle_buf, (struct mesg_info_t *, int));
static char *FDECL(split, (char *, XFontStruct *, DIMENSION_P));
static void FDECL(add_line, (struct mesg_info_t *, const char *));
static void FDECL(redraw_message_window, (struct xwindow *));
static void FDECL(mesg_check_size_change, (struct xwindow *));
static void FDECL(mesg_exposed, (Widget, XtPointer, XtPointer));
static void FDECL(get_gc, (Widget, struct mesg_info_t *));
static void FDECL(mesg_resized, (Widget, XtPointer, XtPointer));
static struct line_element *get_previous(struct line_element *);
static void set_circle_buf(struct mesg_info_t *, int);
static char *split(char *, XFontStruct *, Dimension);
static void add_line(struct mesg_info_t *, const char *);
static void redraw_message_window(struct xwindow *);
static void mesg_check_size_change(struct xwindow *);
static void mesg_exposed(Widget, XtPointer, XtPointer);
static void get_gc(Widget, struct mesg_info_t *);
static void mesg_resized(Widget, XtPointer, XtPointer);
static char mesg_translations[] = "#override\n\
<Key>Left: scroll(4)\n\
@@ -56,8 +56,7 @@ static char mesg_translations[] = "#override\n\
/* Move the message window's vertical scrollbar's slider to the bottom. */
void
set_message_slider(wp)
struct xwindow *wp;
set_message_slider(struct xwindow *wp)
{
Widget scrollbar;
float top;
@@ -71,10 +70,8 @@ struct xwindow *wp;
}
void
create_message_window(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */
boolean create_popup;
Widget parent;
create_message_window(struct xwindow *wp, /* window pointer */
boolean create_popup, Widget parent)
{
Arg args[8];
Cardinal num_args;
@@ -209,8 +206,7 @@ Widget parent;
}
void
destroy_message_window(wp)
struct xwindow *wp;
destroy_message_window(struct xwindow *wp)
{
if (wp->popup) {
nh_XtPopdown(wp->popup);
@@ -230,8 +226,7 @@ struct xwindow *wp;
/* Redraw message window if new lines have been added. */
void
display_message_window(wp)
struct xwindow *wp;
display_message_window(struct xwindow *wp)
{
set_message_slider(wp);
if (wp->mesg_information->dirty)
@@ -243,9 +238,7 @@ struct xwindow *wp;
* rendering of the text is too long for the window.
*/
void
append_message(wp, str)
struct xwindow *wp;
const char *str;
append_message(struct xwindow *wp, const char *str)
{
char *mark, *remainder, buf[BUFSZ];
@@ -270,8 +263,7 @@ const char *str;
* element.
*/
static struct line_element *
get_previous(mark)
struct line_element *mark;
get_previous(struct line_element *mark)
{
struct line_element *curr;
@@ -290,9 +282,7 @@ struct line_element *mark;
* are no longer used.
*/
static void
set_circle_buf(mesg_info, count)
struct mesg_info_t *mesg_info;
int count;
set_circle_buf(struct mesg_info_t *mesg_info, int count)
{
int i;
struct line_element *tail, *curr, *head;
@@ -367,10 +357,9 @@ int count;
* not, back up from the end by words until we find a place to split.
*/
static char *
split(s, fs, pixel_width)
char *s;
XFontStruct *fs; /* Font for the window. */
Dimension pixel_width;
split(char *s,
XFontStruct *fs, /* Font for the window. */
Dimension pixel_width)
{
char save, *end, *remainder;
@@ -400,9 +389,7 @@ Dimension pixel_width;
* one.
*/
static void
add_line(mesg_info, s)
struct mesg_info_t *mesg_info;
const char *s;
add_line(struct mesg_info_t *mesg_info, const char *s)
{
register struct line_element *curr = mesg_info->head;
register int new_line_length = strlen(s);
@@ -431,8 +418,7 @@ const char *s;
* line above this saved pointer.
*/
void
set_last_pause(wp)
struct xwindow *wp;
set_last_pause(struct xwindow *wp)
{
register struct mesg_info_t *mesg_info = wp->mesg_information;
@@ -459,8 +445,7 @@ struct xwindow *wp;
}
static void
redraw_message_window(wp)
struct xwindow *wp;
redraw_message_window(struct xwindow *wp)
{
struct mesg_info_t *mesg_info = wp->mesg_information;
register struct line_element *curr;
@@ -504,8 +489,7 @@ struct xwindow *wp;
* move the vertical slider to the bottom.
*/
static void
mesg_check_size_change(wp)
struct xwindow *wp;
mesg_check_size_change(struct xwindow *wp)
{
struct mesg_info_t *mesg_info = wp->mesg_information;
Arg arg[2];
@@ -531,10 +515,9 @@ struct xwindow *wp;
/* Event handler for message window expose events. */
/*ARGSUSED*/
static void
mesg_exposed(w, client_data, widget_data)
Widget w;
XtPointer client_data; /* unused */
XtPointer widget_data; /* expose event from Window widget */
mesg_exposed(Widget w,
XtPointer client_data, /* unused */
XtPointer widget_data) /* expose event from Window widget */
{
XExposeEvent *event = (XExposeEvent *) widget_data;
@@ -564,9 +547,7 @@ XtPointer widget_data; /* expose event from Window widget */
}
static void
get_gc(w, mesg_info)
Widget w;
struct mesg_info_t *mesg_info;
get_gc(Widget w, struct mesg_info_t *mesg_info)
{
XGCValues values;
XtGCMask mask = GCFunction | GCForeground | GCBackground | GCFont;
@@ -596,9 +577,7 @@ struct mesg_info_t *mesg_info;
*/
/* ARGSUSED */
static void
mesg_resized(w, client_data, call_data)
Widget w;
XtPointer call_data, client_data;
mesg_resized(Widget w, XtPointer call_data, XtPointer client_data)
{
Arg args[4];
Cardinal num_args;
+75 -160
View File
@@ -91,47 +91,44 @@ static const char popup_entry_translations[] = "#override\n\
<Btn4Down>: scroll(8)\n\
<Btn5Down>: scroll(2)";
static void NDECL(plsel_dialog_acceptvalues);
static void FDECL(plsel_set_play_button, (BOOLEAN_P));
static void FDECL(plsel_set_sensitivities, (BOOLEAN_P));
static void NDECL(X11_player_selection_randomize);
static void NDECL(X11_player_selection_setupOthers);
static void FDECL(racetoggleCallback, (Widget, XtPointer, XtPointer));
static void FDECL(roletoggleCallback, (Widget, XtPointer, XtPointer));
static void FDECL(gendertoggleCallback, (Widget, XtPointer, XtPointer));
static void FDECL(aligntoggleCallback, (Widget, XtPointer, XtPointer));
static void FDECL(plsel_random_btn_callback, (Widget, XtPointer, XtPointer));
static void FDECL(plsel_play_btn_callback, (Widget, XtPointer, XtPointer));
static void FDECL(plsel_quit_btn_callback, (Widget, XtPointer, XtPointer));
static Widget FDECL(X11_create_player_selection_name, (Widget));
static void NDECL(X11_player_selection_dialog);
static void NDECL(X11_player_selection_prompts);
static void FDECL(ps_quit, (Widget, XtPointer, XtPointer));
static void FDECL(ps_random, (Widget, XtPointer, XtPointer));
static void FDECL(ps_select, (Widget, XtPointer, XtPointer));
static void FDECL(extend_select, (Widget, XtPointer, XtPointer));
static void FDECL(extend_dismiss, (Widget, XtPointer, XtPointer));
static void FDECL(extend_help, (Widget, XtPointer, XtPointer));
static void FDECL(popup_delete, (Widget, XEvent *, String *, Cardinal *));
static void NDECL(ec_dismiss);
static void FDECL(ec_scroll_to_view, (int));
static void NDECL(init_extended_commands_popup);
static Widget FDECL(make_menu, (const char *, const char *, const char *,
const char *, XtCallbackProc, const char *,
XtCallbackProc, int, const char **,
Widget **, XtCallbackProc, Widget *));
static void plsel_dialog_acceptvalues(void);
static void plsel_set_play_button(boolean);
static void plsel_set_sensitivities(boolean);
static void X11_player_selection_randomize(void);
static void X11_player_selection_setupOthers(void);
static void racetoggleCallback(Widget, XtPointer, XtPointer);
static void roletoggleCallback(Widget, XtPointer, XtPointer);
static void gendertoggleCallback(Widget, XtPointer, XtPointer);
static void aligntoggleCallback(Widget, XtPointer, XtPointer);
static void plsel_random_btn_callback(Widget, XtPointer, XtPointer);
static void plsel_play_btn_callback(Widget, XtPointer, XtPointer);
static void plsel_quit_btn_callback(Widget, XtPointer, XtPointer);
static Widget X11_create_player_selection_name(Widget);
static void X11_player_selection_dialog(void);
static void X11_player_selection_prompts(void);
static void ps_quit(Widget, XtPointer, XtPointer);
static void ps_random(Widget, XtPointer, XtPointer);
static void ps_select(Widget, XtPointer, XtPointer);
static void extend_select(Widget, XtPointer, XtPointer);
static void extend_dismiss(Widget, XtPointer, XtPointer);
static void extend_help(Widget, XtPointer, XtPointer);
static void popup_delete(Widget, XEvent *, String *, Cardinal *);
static void ec_dismiss(void);
static void ec_scroll_to_view(int);
static void init_extended_commands_popup(void);
static Widget make_menu(const char *, const char *, const char *, const char *,
XtCallbackProc, const char *, XtCallbackProc, int,
const char **, Widget **, XtCallbackProc, Widget *);
/* Bad Hack alert. Using integers instead of XtPointers */
XtPointer
i2xtp(i)
int i;
i2xtp(int i)
{
return (XtPointer) (ptrdiff_t) i;
}
int
xtp2i(x)
XtPointer x;
xtp2i(XtPointer x)
{
return (int) (ptrdiff_t) x;
}
@@ -139,9 +136,7 @@ XtPointer x;
/* Player Selection ------------------------------------------------------- */
/* ARGSUSED */
static void
ps_quit(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
ps_quit(Widget w, XtPointer client_data, XtPointer call_data)
{
nhUse(w);
nhUse(client_data);
@@ -153,9 +148,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
ps_random(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
ps_random(Widget w, XtPointer client_data, XtPointer call_data)
{
nhUse(w);
nhUse(client_data);
@@ -167,9 +160,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
ps_select(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
ps_select(Widget w, XtPointer client_data, XtPointer call_data)
{
nhUse(w);
nhUse(call_data);
@@ -180,11 +171,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
void
ps_key(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
ps_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
char ch, *mark;
char rolechars[QBUFSZ];
@@ -230,11 +217,7 @@ Cardinal *num_params;
/* ARGSUSED */
void
race_key(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
race_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
char ch, *mark;
char racechars[QBUFSZ];
@@ -278,11 +261,7 @@ Cardinal *num_params;
/* ARGSUSED */
void
gend_key(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
gend_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
char ch, *mark;
static char gendchars[] = "mf";
@@ -315,11 +294,7 @@ Cardinal *num_params;
/* ARGSUSED */
void
algn_key(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
algn_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
char ch, *mark;
static char algnchars[] = "LNC";
@@ -361,7 +336,7 @@ Widget plsel_name_input;
Widget plsel_btn_play;
static void
plsel_dialog_acceptvalues()
plsel_dialog_acceptvalues(void)
{
Arg args[2];
String s;
@@ -384,11 +359,7 @@ plsel_dialog_acceptvalues()
/* ARGSUSED */
void
plsel_quit(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
plsel_quit(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
nhUse(w);
nhUse(event);
@@ -401,11 +372,7 @@ Cardinal *num_params;
/* ARGSUSED */
void
plsel_play(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
plsel_play(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Arg args[2];
Boolean state;
@@ -428,11 +395,7 @@ Cardinal *num_params;
/* ARGSUSED */
void
plsel_randomize(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
plsel_randomize(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
nhUse(w);
nhUse(event);
@@ -444,8 +407,7 @@ Cardinal *num_params;
/* enable or disable the Play button */
static void
plsel_set_play_button(state)
boolean state;
plsel_set_play_button(boolean state)
{
Arg args[2];
@@ -454,8 +416,7 @@ boolean state;
}
static void
plsel_set_sensitivities(setcurr)
boolean setcurr;
plsel_set_sensitivities(boolean setcurr)
{
Arg args[2];
int j, valid;
@@ -508,7 +469,7 @@ boolean setcurr;
}
static void
X11_player_selection_randomize()
X11_player_selection_randomize(void)
{
int nrole = plsel_n_roles;
int nrace = plsel_n_races;
@@ -595,7 +556,7 @@ X11_player_selection_randomize()
}
static void
X11_player_selection_setupOthers()
X11_player_selection_setupOthers(void)
{
Arg args[2];
int ra = xtp2i(XawToggleGetCurrent(plsel_race_radios[0])) - 1;
@@ -641,9 +602,7 @@ X11_player_selection_setupOthers()
}
static void
racetoggleCallback(w, client, call)
Widget w;
XtPointer client, call;
racetoggleCallback(Widget w, XtPointer client, XtPointer call)
{
Arg args[2];
int j, valid;
@@ -682,9 +641,7 @@ XtPointer client, call;
}
static void
roletoggleCallback(w, client, call)
Widget w;
XtPointer client, call;
roletoggleCallback(Widget w, XtPointer client, XtPointer call)
{
Arg args[2];
int j, valid;
@@ -723,9 +680,7 @@ XtPointer client, call;
}
static void
gendertoggleCallback(w, client, call)
Widget w;
XtPointer client, call;
gendertoggleCallback(Widget w, XtPointer client, XtPointer call)
{
int i, r = xtp2i(XawToggleGetCurrent(plsel_gend_radios[0])) - 1;
@@ -747,9 +702,7 @@ XtPointer client, call;
}
static void
aligntoggleCallback(w, client, call)
Widget w;
XtPointer client, call;
aligntoggleCallback(Widget w, XtPointer client, XtPointer call)
{
int r = xtp2i(XawToggleGetCurrent(plsel_align_radios[0])) - 1;
@@ -761,10 +714,7 @@ XtPointer client, call;
}
static void
plsel_random_btn_callback(w, client, call)
Widget w;
XtPointer client;
XtPointer call;
plsel_random_btn_callback(Widget w, XtPointer client, XtPointer call)
{
nhUse(w);
nhUse(client);
@@ -774,10 +724,7 @@ XtPointer call;
}
static void
plsel_play_btn_callback(w, client, call)
Widget w;
XtPointer client;
XtPointer call;
plsel_play_btn_callback(Widget w, XtPointer client, XtPointer call)
{
nhUse(w);
nhUse(client);
@@ -788,10 +735,7 @@ XtPointer call;
}
static void
plsel_quit_btn_callback(w, client, call)
Widget w;
XtPointer client;
XtPointer call;
plsel_quit_btn_callback(Widget w, XtPointer client, XtPointer call)
{
nhUse(w);
nhUse(client);
@@ -802,8 +746,7 @@ XtPointer call;
}
static Widget
X11_create_player_selection_name(form)
Widget form;
X11_create_player_selection_name(Widget form)
{
Widget namelabel, name_vp, name_form;
Arg args[10];
@@ -865,7 +808,7 @@ Widget form;
}
static void
X11_player_selection_dialog()
X11_player_selection_dialog(void)
{
Widget popup, popup_vp;
Widget form;
@@ -1290,7 +1233,7 @@ X11_player_selection_dialog()
}
static void
X11_player_selection_prompts()
X11_player_selection_prompts(void)
{
int num_roles, num_races, num_gends, num_algns, i, availcount, availindex;
Widget popup, player_form;
@@ -1578,7 +1521,7 @@ X11_player_selection_prompts()
/* Global functions ======================================================== */
void
X11_player_selection()
X11_player_selection(void)
{
if (iflags.wc_player_selection == VIA_DIALOG) {
if (!*g.plname) {
@@ -1600,7 +1543,7 @@ X11_player_selection()
/* called by core to have the player pick an extended command */
int
X11_get_ext_cmd()
X11_get_ext_cmd(void)
{
if (iflags.extmenu != ec_full_list) {
/* player has toggled the 'extmenu' option, toss the old widgets */
@@ -1627,7 +1570,7 @@ X11_get_ext_cmd()
}
void
release_extended_cmds()
release_extended_cmds(void)
{
if (extended_commands) {
XtDestroyWidget(extended_command_popup), extended_command_popup = 0;
@@ -1642,9 +1585,7 @@ release_extended_cmds()
/* Extended Command ------------------------------------------------------- */
/* ARGSUSED */
static void
extend_select(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
extend_select(Widget w, XtPointer client_data, XtPointer call_data)
{
int selected = (int) (ptrdiff_t) client_data;
@@ -1670,9 +1611,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
extend_dismiss(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
extend_dismiss(Widget w, XtPointer client_data, XtPointer call_data)
{
nhUse(w);
nhUse(client_data);
@@ -1683,9 +1622,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
static void
extend_help(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
extend_help(Widget w, XtPointer client_data, XtPointer call_data)
{
nhUse(w);
nhUse(client_data);
@@ -1697,11 +1634,7 @@ XtPointer client_data, call_data;
/* ARGSUSED */
void
ec_delete(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
ec_delete(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
if (w == extended_command_popup) {
ec_dismiss();
@@ -1712,11 +1645,7 @@ Cardinal *num_params;
/* ARGSUSED */
static void
popup_delete(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
popup_delete(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
nhUse(event);
nhUse(params);
@@ -1728,7 +1657,7 @@ Cardinal *num_params;
}
static void
ec_dismiss()
ec_dismiss(void)
{
/* unselect while still visible */
if (extended_cmd_selected >= 0)
@@ -1742,8 +1671,7 @@ ec_dismiss()
/* scroll the extended command menu if necessary
so that choices extended_cmd_selected through ec_indx will be visible */
static void
ec_scroll_to_view(ec_indx)
int ec_indx; /* might be greater than extended_cmd_selected */
ec_scroll_to_view(int ec_indx) /* might be greater than extended_cmd_selected */
{
Widget viewport, scrollbar, tmpw;
Arg args[5];
@@ -1846,8 +1774,7 @@ int ec_indx; /* might be greater than extended_cmd_selected */
/* decide whether extcmdlist[idx] should be part of extended commands menu */
static boolean
ignore_extcmd(idx)
int idx;
ignore_extcmd(int idx)
{
/* #shell or #suspect might not be available;
'extmenu' option controls whether we show full list
@@ -1862,11 +1789,7 @@ int idx;
/* ARGSUSED */
void
ec_key(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
ec_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
char ch;
int i, pass;
@@ -1984,7 +1907,7 @@ Cardinal *num_params;
* be used from a menubox.
*/
static void
init_extended_commands_popup()
init_extended_commands_popup(void)
{
int i, j, num_commands, ignore_cmds = 0;
@@ -2036,21 +1959,13 @@ init_extended_commands_popup()
* ------------------------
*/
static Widget
make_menu(popup_name, popup_label, popup_translations, left_name,
left_callback, right_name, right_callback, num_names, widget_names,
command_widgets, name_callback, formp)
const char *popup_name;
const char *popup_label;
const char *popup_translations;
const char *left_name;
XtCallbackProc left_callback;
const char *right_name;
XtCallbackProc right_callback;
int num_names;
const char **widget_names; /* return array of command widgets */
Widget **command_widgets;
XtCallbackProc name_callback;
Widget *formp; /* return */
make_menu(const char *popup_name, const char *popup_label,
const char *popup_translations, const char *left_name,
XtCallbackProc left_callback, const char *right_name,
XtCallbackProc right_callback, int num_names,
const char **widget_names, /* return array of command widgets */
Widget **command_widgets,
XtCallbackProc name_callback, Widget *formp) /* return */
{
Widget popup, popform, form, label, above, left, right, view;
Widget *commands, *curr;
+97 -162
View File
@@ -95,30 +95,28 @@
#define NUM_STATS 41
static int FDECL(condcolor, (long, unsigned long *));
static int FDECL(condattr, (long, unsigned long *));
static void FDECL(HiliteField, (Widget, int, int, int, XFontStruct **));
static void FDECL(PrepStatusField, (int, Widget, const char *));
static void FDECL(DisplayCond, (int, unsigned long *));
static int FDECL(render_conditions, (int, int));
static int condcolor(long, unsigned long *);
static int condattr(long, unsigned long *);
static void HiliteField(Widget, int, int, int, XFontStruct **);
static void PrepStatusField(int, Widget, const char *);
static void DisplayCond(int, unsigned long *);
static int render_conditions(int, int);
#ifdef STATUS_HILITES
static void FDECL(tt_reset_color, (int, int, unsigned long *));
static void tt_reset_color(int, int, unsigned long *);
#endif
static void NDECL(tt_status_fixup);
static Widget FDECL(create_tty_status_field, (int, int, Widget, Widget));
static Widget FDECL(create_tty_status, (Widget, Widget));
static void FDECL(update_fancy_status_field, (int, int, int));
static void FDECL(update_fancy_status, (BOOLEAN_P));
static Widget FDECL(create_fancy_status, (Widget, Widget));
static void FDECL(destroy_fancy_status, (struct xwindow *));
static void FDECL(create_status_window_fancy, (struct xwindow *,
BOOLEAN_P, Widget));
static void FDECL(create_status_window_tty, (struct xwindow *,
BOOLEAN_P, Widget));
static void FDECL(destroy_status_window_fancy, (struct xwindow *));
static void FDECL(destroy_status_window_tty, (struct xwindow *));
static void FDECL(adjust_status_fancy, (struct xwindow *, const char *));
static void FDECL(adjust_status_tty, (struct xwindow *, const char *));
static void tt_status_fixup(void);
static Widget create_tty_status_field(int, int, Widget, Widget);
static Widget create_tty_status(Widget, Widget);
static void update_fancy_status_field(int, int, int);
static void update_fancy_status(boolean);
static Widget create_fancy_status(Widget, Widget);
static void destroy_fancy_status(struct xwindow *);
static void create_status_window_fancy(struct xwindow *, boolean, Widget);
static void create_status_window_tty(struct xwindow *, boolean, Widget);
static void destroy_status_window_fancy(struct xwindow *);
static void destroy_status_window_tty(struct xwindow *);
static void adjust_status_fancy(struct xwindow *, const char *);
static void adjust_status_tty(struct xwindow *, const char *);
extern const char *status_fieldfmt[MAXBLSTATS];
extern char *status_vals[MAXBLSTATS];
@@ -200,9 +198,7 @@ static Pixel X11_status_fg, X11_status_bg;
struct xwindow *xw_status_win;
static int
condcolor(bm, bmarray)
long bm;
unsigned long *bmarray;
condcolor(long bm, unsigned long *bmarray)
{
int i;
@@ -215,9 +211,7 @@ unsigned long *bmarray;
}
static int
condattr(bm, bmarray)
long bm;
unsigned long *bmarray;
condattr(long bm, unsigned long *bmarray)
{
int attr = 0;
int i;
@@ -249,7 +243,7 @@ unsigned long *bmarray;
}
void
X11_status_init()
X11_status_init(void)
{
int i;
@@ -265,26 +259,22 @@ X11_status_init()
}
void
X11_status_finish()
X11_status_finish(void)
{
/* nothing */
return;
}
void
X11_status_enablefield(fieldidx, nm, fmt, enable)
int fieldidx;
const char *nm;
const char *fmt;
boolean enable;
X11_status_enablefield(int fieldidx, const char *nm,
const char *fmt, boolean enable)
{
genl_status_enablefield(fieldidx, nm, fmt, enable);
}
#if 0
int
cond_bm2idx(bm)
unsigned long bm;
cond_bm2idx(unsigned long bm)
{
int i;
@@ -297,10 +287,9 @@ unsigned long bm;
/* highlight a tty-style status field (or condition) */
static void
HiliteField(label, fld, cond, colrattr, font_p)
Widget label;
int fld, cond, colrattr;
XFontStruct **font_p;
HiliteField(Widget label,
int fld, int cond, int colrattr,
XFontStruct **font_p)
{
#ifdef STATUS_HILITES
static Pixel grayPxl, blackPxl, whitePxl;
@@ -378,10 +367,7 @@ XFontStruct **font_p;
/* set up a specific field other than 'condition'; its general location
was specified during widget creation but it might need adjusting */
static void
PrepStatusField(fld, label, text)
int fld;
Widget label;
const char *text;
PrepStatusField(int fld, Widget label, const char *text)
{
Arg args[6];
Cardinal num_args;
@@ -411,9 +397,8 @@ const char *text;
/* set up one status condition for tty-style status display */
static void
DisplayCond(c_idx, colormasks)
int c_idx; /* index into tt_condorder[] */
unsigned long *colormasks;
DisplayCond(int c_idx, /* index into tt_condorder[] */
unsigned long *colormasks)
{
Widget label;
Arg args[6];
@@ -459,8 +444,7 @@ unsigned long *colormasks;
/* display the tty-style status conditions; the number shown varies and
we might be showing more, same, or fewer than during previous status */
static int
render_conditions(row, dx)
int row, dx;
render_conditions(int row, int dx)
{
Widget label;
Arg args[6];
@@ -524,9 +508,7 @@ int row, dx;
/* reset status_hilite for BL_RESET; if highlighting has been disabled or
this field is disabled, clear highlighting for this field or condition */
static void
tt_reset_color(fld, cond, colormasks)
int fld, cond;
unsigned long *colormasks;
tt_reset_color(int fld, int cond, unsigned long *colormasks)
{
Widget label;
int colrattr = NO_COLOR;
@@ -557,7 +539,7 @@ unsigned long *colormasks;
then explicitly set them for all the status widgets;
also cache some geometry settings in (*xw_status_win).Status_info */
static void
tt_status_fixup()
tt_status_fixup(void)
{
Arg args[6];
Cardinal num_args;
@@ -663,10 +645,10 @@ tt_status_fixup()
/* core requests updating one status field (or is indicating that it's time
to flush all updated fields); tty-style handling */
static void
X11_status_update_tty(fld, ptr, chg, percent, color, colormasks)
int fld, chg UNUSED, percent, color;
genericptr_t ptr;
unsigned long *colormasks; /* bitmask of highlights for conditions */
X11_status_update_tty(int fld, genericptr_t ptr, int chg UNUSED, int percent,
int color,
unsigned long *colormasks) /* bitmask of highlights
for conditions */
{
static int xtra_space[MAXBLSTATS];
static unsigned long *cond_colormasks = (unsigned long *) 0;
@@ -830,10 +812,9 @@ unsigned long *colormasks; /* bitmask of highlights for conditions */
/*ARGSUSED*/
static void
X11_status_update_fancy(fld, ptr, chg, percent, colrattr, colormasks)
int fld, chg UNUSED, percent UNUSED, colrattr;
genericptr_t ptr;
unsigned long *colormasks;
X11_status_update_fancy(int fld, genericptr_t ptr, int chg UNUSED,
int percent UNUSED, int colrattr,
unsigned long *colormasks UNUSED)
{
static const struct bl_to_ff {
int bl, ff;
@@ -927,10 +908,9 @@ unsigned long *colormasks;
}
void
X11_status_update(fld, ptr, chg, percent, color, colormasks)
int fld, chg UNUSED, percent UNUSED, color;
genericptr_t ptr;
unsigned long *colormasks;
X11_status_update(int fld, genericptr_t ptr, int chg,
int percent, int color,
unsigned long *colormasks)
{
if (fld < BL_RESET || fld >= MAXBLSTATS)
panic("X11_status_update(%d) -- invalid field", fld);
@@ -943,9 +923,7 @@ unsigned long *colormasks;
/* create a widget for a particular status field or potential condition */
static Widget
create_tty_status_field(fld, condindx, above, left)
int fld, condindx;
Widget above, left;
create_tty_status_field(int fld, int condindx, Widget above, Widget left)
{
Arg args[16];
Cardinal num_args;
@@ -985,8 +963,7 @@ Widget above, left;
/* create an overall status widget (X11_status_widget) and also
separate widgets for all status fields and potential conditions */
static Widget
create_tty_status(parent, top)
Widget parent, top;
create_tty_status(Widget parent, Widget top)
{
Widget form; /* viewport that holds the form that surrounds everything */
Widget w, over_w, prev_w;
@@ -1040,18 +1017,15 @@ Widget parent, top;
/*ARGSUSED*/
void
create_status_window_tty(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */
boolean create_popup UNUSED;
Widget parent;
create_status_window_tty(struct xwindow *wp, /* window pointer */
boolean create_popup UNUSED, Widget parent)
{
wp->type = NHW_STATUS;
wp->w = create_tty_status(parent, (Widget) 0);
}
void
destroy_status_window_tty(wp)
struct xwindow *wp;
destroy_status_window_tty(struct xwindow *wp)
{
/* If status_information is defined, then it a "text" status window. */
if (wp->status_information) {
@@ -1071,19 +1045,15 @@ struct xwindow *wp;
/*ARGSUSED*/
void
adjust_status_tty(wp, str)
struct xwindow *wp UNUSED;
const char *str UNUSED;
adjust_status_tty(struct xwindow *wp UNUSED, const char *str UNUSED)
{
/* nothing */
return;
}
void
create_status_window(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */
boolean create_popup;
Widget parent;
create_status_window(struct xwindow *wp, /* window pointer */
boolean create_popup, Widget parent)
{
struct status_info_t *si = (struct status_info_t *) alloc(sizeof *si);
@@ -1100,8 +1070,7 @@ Widget parent;
}
void
destroy_status_window(wp)
struct xwindow *wp;
destroy_status_window(struct xwindow *wp)
{
if (appResources.fancy_status)
destroy_status_window_fancy(wp);
@@ -1110,9 +1079,7 @@ struct xwindow *wp;
}
void
adjust_status(wp, str)
struct xwindow *wp;
const char *str;
adjust_status(struct xwindow *wp, const char *str)
{
if (appResources.fancy_status)
adjust_status_fancy(wp, str);
@@ -1121,10 +1088,8 @@ const char *str;
}
void
create_status_window_fancy(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */
boolean create_popup;
Widget parent;
create_status_window_fancy(struct xwindow *wp, /* window pointer */
boolean create_popup, Widget parent)
{
XFontStruct *fs;
Arg args[8];
@@ -1203,8 +1168,7 @@ Widget parent;
}
void
destroy_status_window_fancy(wp)
struct xwindow *wp;
destroy_status_window_fancy(struct xwindow *wp)
{
/* If status_information is defined, then it a "text" status window. */
if (wp->status_information) {
@@ -1229,9 +1193,7 @@ struct xwindow *wp;
* + We didn't set stringInPlace on the widget.
*/
void
adjust_status_fancy(wp, str)
struct xwindow *wp;
const char *str;
adjust_status_fancy(struct xwindow *wp, const char *str)
{
Arg args[2];
Cardinal num_args;
@@ -1289,22 +1251,21 @@ struct f_overload {
struct ovld_item conds[NUM_OVLD];
};
static const struct f_overload *FDECL(ff_ovld_from_mask, (unsigned long));
static const struct f_overload *FDECL(ff_ovld_from_indx, (int));
static void FDECL(hilight_label, (Widget));
static void FDECL(update_val, (struct X_status_value *, long));
static void FDECL(skip_cond_val, (struct X_status_value *));
static void FDECL(update_color, (struct X_status_value *, int));
static boolean FDECL(name_widget_has_label, (struct X_status_value *));
static void FDECL(apply_hilite_attributes, (struct X_status_value *, int));
static const char *FDECL(width_string, (int));
static void FDECL(create_widget, (Widget, struct X_status_value *, int));
static void FDECL(get_widths, (struct X_status_value *, int *, int *));
static void FDECL(set_widths, (struct X_status_value *, int, int));
static Widget FDECL(init_column, (const char *, Widget, Widget, Widget,
int *, int));
static void NDECL(fixup_cond_widths);
static Widget FDECL(init_info_form, (Widget, Widget, Widget));
static const struct f_overload *ff_ovld_from_mask(unsigned long);
static const struct f_overload *ff_ovld_from_indx(int);
static void hilight_label(Widget);
static void update_val(struct X_status_value *, long);
static void skip_cond_val(struct X_status_value *);
static void update_color(struct X_status_value *, int);
static boolean name_widget_has_label(struct X_status_value *);
static void apply_hilite_attributes(struct X_status_value *, int);
static const char *width_string(int);
static void create_widget(Widget, struct X_status_value *, int);
static void get_widths(struct X_status_value *, int *, int *);
static void set_widths(struct X_status_value *, int, int);
static Widget init_column(const char *, Widget, Widget, Widget, int *, int);
static void fixup_cond_widths(void);
static Widget init_info_form(Widget, Widget, Widget);
/*
* Notes:
@@ -1413,8 +1374,7 @@ static const struct f_overload cond_ovl[] = {
};
static const struct f_overload *
ff_ovld_from_mask(mask)
unsigned long mask;
ff_ovld_from_mask(unsigned long mask)
{
const struct f_overload *fo;
@@ -1426,8 +1386,7 @@ unsigned long mask;
}
static const struct f_overload *
ff_ovld_from_indx(indx)
int indx; /* F_foo number, index into shown_stats[] */
ff_ovld_from_indx(int indx) /* F_foo number, index into shown_stats[] */
{
const struct f_overload *fo;
int i, ff;
@@ -1448,7 +1407,7 @@ int indx; /* F_foo number, index into shown_stats[] */
* kinds of funny values being displayed.
*/
void
null_out_status()
null_out_status(void)
{
int i;
struct X_status_value *sv;
@@ -1475,8 +1434,7 @@ null_out_status()
/* this is almost an exact duplicate of hilight_value() */
static void
hilight_label(w)
Widget w; /* label widget */
hilight_label(Widget w) /* label widget */
{
/*
* This predates STATUS_HILITES.
@@ -1487,9 +1445,7 @@ Widget w; /* label widget */
}
static void
update_val(attr_rec, new_value)
struct X_status_value *attr_rec;
long new_value;
update_val(struct X_status_value *attr_rec, long new_value)
{
static boolean Exp_shown = TRUE, time_shown = TRUE, score_shown = TRUE,
Xp_was_HD = FALSE;
@@ -1699,8 +1655,7 @@ long new_value;
/* overloaded condition is being cleared without going through update_val()
so that an alternate can be shown; put this one back to default settings */
static void
skip_cond_val(sv)
struct X_status_value *sv;
skip_cond_val(struct X_status_value *sv)
{
sv->last_value = 0L; /* Off */
if (sv->set) {
@@ -1714,9 +1669,7 @@ struct X_status_value *sv;
}
static void
update_color(sv, color)
struct X_status_value *sv;
int color;
update_color(struct X_status_value *sv, int color)
{
Pixel pixel = 0;
Arg args[1];
@@ -1747,8 +1700,7 @@ int color;
}
static boolean
name_widget_has_label(sv)
struct X_status_value *sv;
name_widget_has_label(struct X_status_value *sv)
{
Arg args[1];
const char *label;
@@ -1759,9 +1711,7 @@ struct X_status_value *sv;
}
static void
apply_hilite_attributes(sv, attributes)
struct X_status_value *sv;
int attributes;
apply_hilite_attributes(struct X_status_value *sv, int attributes)
{
boolean attr_inversion = ((HL_INVERSE & attributes)
&& (sv->type != SV_NAME
@@ -1801,8 +1751,7 @@ int attributes;
* [**] HD is shown instead of level and exp if Upolyd.
*/
static void
update_fancy_status_field(i, color, attributes)
int i, color, attributes;
update_fancy_status_field(int i, int color, int attributes)
{
struct X_status_value *sv = &shown_stats[i];
unsigned long condmask = 0L;
@@ -1990,8 +1939,7 @@ int i, color, attributes;
/* fully update status after bl_flush or window resize */
static void
update_fancy_status(force_update)
boolean force_update;
update_fancy_status(boolean force_update)
{
static boolean old_showtime, old_showexp, old_showscore;
static int old_upolyd = -1; /* -1: force first time update */
@@ -2023,7 +1971,7 @@ boolean force_update;
* Turn off hilighted status values after a certain amount of turns.
*/
void
check_turn_events()
check_turn_events(void)
{
int i;
struct X_status_value *sv;
@@ -2050,8 +1998,7 @@ check_turn_events()
/* Return a string for the initial width, so use longest possible value. */
static const char *
width_string(sv_index)
int sv_index;
width_string(int sv_index)
{
switch (sv_index) {
case F_DUMMY:
@@ -2121,10 +2068,7 @@ int sv_index;
}
static void
create_widget(parent, sv, sv_index)
Widget parent;
struct X_status_value *sv;
int sv_index;
create_widget(Widget parent, struct X_status_value *sv, int sv_index)
{
Arg args[4];
Cardinal num_args;
@@ -2195,9 +2139,7 @@ int sv_index;
* Get current width of value. width2p is only valid for SV_VALUE types.
*/
static void
get_widths(sv, width1p, width2p)
struct X_status_value *sv;
int *width1p, *width2p;
get_widths(struct X_status_value *sv, int *width1p, int *width2p)
{
Arg args[1];
Dimension width;
@@ -2220,9 +2162,7 @@ int *width1p, *width2p;
}
static void
set_widths(sv, width1, width2)
struct X_status_value *sv;
int width1, width2;
set_widths(struct X_status_value *sv, int width1, int width2)
{
Arg args[1];
@@ -2242,10 +2182,8 @@ int width1, width2;
}
static Widget
init_column(name, parent, top, left, col_indices, xtrawidth)
const char *name;
Widget parent, top, left;
int *col_indices, xtrawidth;
init_column(const char *name, Widget parent, Widget top, Widget left,
int *col_indices, int xtrawidth)
{
Widget form;
Arg args[4];
@@ -2365,8 +2303,7 @@ static int characteristics_indices[11 - 2] = {
* TODO: widen title field and implement hitpoint bar on it.
*/
static Widget
init_info_form(parent, top, left)
Widget parent, top, left;
init_info_form(Widget parent, Widget top, Widget left)
{
Widget form, col1, col2;
struct X_status_value *sv_name, *sv_dlevel;
@@ -2425,7 +2362,7 @@ Widget parent, top, left;
/* give the three status condition columns the same width */
static void
fixup_cond_widths()
fixup_cond_widths(void)
{
int pass, i, *ip, w1, w2;
@@ -2462,8 +2399,7 @@ fixup_cond_widths()
* contains everything.
*/
static Widget
create_fancy_status(parent, top)
Widget parent, top;
create_fancy_status(Widget parent, Widget top)
{
Widget form; /* The form that surrounds everything. */
Widget w;
@@ -2510,8 +2446,7 @@ Widget parent, top;
}
static void
destroy_fancy_status(wp)
struct xwindow *wp;
destroy_fancy_status(struct xwindow *wp)
{
int i;
struct X_status_value *sv;
+18 -49
View File
@@ -48,16 +48,12 @@ static const char rip_translations[] = "#override\n\
<BtnDown>: rip_dismiss_text()\n\
<Key>: rip_dismiss_text()";
static Widget FDECL(create_ripout_widget, (Widget));
static Widget create_ripout_widget(Widget);
#endif
/*ARGSUSED*/
void
delete_text(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
delete_text(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
struct xwindow *wp;
struct text_info_t *text_info;
@@ -85,11 +81,7 @@ Cardinal *num_params;
*/
/*ARGSUSED*/
void
dismiss_text(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
dismiss_text(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
struct xwindow *wp;
struct text_info_t *text_info;
@@ -112,11 +104,7 @@ Cardinal *num_params;
/* Dismiss when a non-modifier key pressed. */
void
key_dismiss_text(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
key_dismiss_text(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
char ch = key_event_to_char((XKeyEvent *) event);
if (ch)
@@ -126,11 +114,7 @@ Cardinal *num_params;
#ifdef GRAPHIC_TOMBSTONE
/* Dismiss from clicking on rip image. */
void
rip_dismiss_text(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
rip_dismiss_text(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
dismiss_text(XtParent(w), event, params, num_params);
}
@@ -138,10 +122,8 @@ Cardinal *num_params;
/* ARGSUSED */
void
add_to_text_window(wp, attr, str)
struct xwindow *wp;
int attr; /* currently unused */
const char *str;
add_to_text_window(struct xwindow *wp, int attr, /* currently unused */
const char *str)
{
struct text_info_t *text_info = wp->text_information;
int width;
@@ -157,9 +139,7 @@ const char *str;
}
void
display_text_window(wp, blocking)
struct xwindow *wp;
boolean blocking;
display_text_window(struct xwindow *wp, boolean blocking)
{
struct text_info_t *text_info;
Arg args[8];
@@ -258,8 +238,7 @@ boolean blocking;
}
void
create_text_window(wp)
struct xwindow *wp;
create_text_window(struct xwindow *wp)
{
struct text_info_t *text_info;
Arg args[8];
@@ -341,8 +320,7 @@ struct xwindow *wp;
}
void
destroy_text_window(wp)
struct xwindow *wp;
destroy_text_window(struct xwindow *wp)
{
/* Don't need to pop down, this only called from dismiss_text(). */
@@ -365,8 +343,7 @@ struct xwindow *wp;
}
void
clear_text_window(wp)
struct xwindow *wp;
clear_text_window(struct xwindow *wp)
{
clear_text_buffer(&wp->text_information->text);
}
@@ -376,10 +353,7 @@ struct xwindow *wp;
/* Append a line to the text buffer. */
void
append_text_buffer(tb, str, concat)
struct text_buffer *tb;
const char *str;
boolean concat;
append_text_buffer(struct text_buffer *tb, const char *str, boolean concat)
{
char *copy;
int length;
@@ -436,8 +410,7 @@ boolean concat;
/* Initialize text buffer. */
void
init_text_buffer(tb)
struct text_buffer *tb;
init_text_buffer(struct text_buffer *tb)
{
tb->text = (char *) alloc(START_SIZE);
tb->text[0] = '\0';
@@ -448,8 +421,7 @@ struct text_buffer *tb;
/* Empty the text buffer */
void
clear_text_buffer(tb)
struct text_buffer *tb;
clear_text_buffer(struct text_buffer *tb)
{
tb->text_last = 0;
tb->text[0] = '\0';
@@ -458,8 +430,7 @@ struct text_buffer *tb;
/* Free up allocated memory. */
void
free_text_buffer(tb)
struct text_buffer *tb;
free_text_buffer(struct text_buffer *tb)
{
free(tb->text);
tb->text = (char *) 0;
@@ -470,7 +441,7 @@ struct text_buffer *tb;
#ifdef GRAPHIC_TOMBSTONE
static void FDECL(rip_exposed, (Widget, XtPointer, XtPointer));
static void rip_exposed(Widget, XtPointer, XtPointer);
static XImage *rip_image = 0;
@@ -538,10 +509,8 @@ calculate_rip_text(int how, time_t when)
*/
/*ARGSUSED*/
static void
rip_exposed(w, client_data, widget_data)
Widget w;
XtPointer client_data UNUSED;
XtPointer widget_data; /* expose event from Window widget */
rip_exposed(Widget w, XtPointer client_data UNUSED,
XtPointer widget_data) /* expose event from Window widget */
{
XExposeEvent *event = (XExposeEvent *) widget_data;
Display *dpy = XtDisplay(w);
+10 -25
View File
@@ -32,9 +32,7 @@
#define WVALUE "value"
Widget
create_value(parent, name_value)
Widget parent;
const char *name_value;
create_value(Widget parent, const char *name_value)
{
Widget form, name;
Arg args[8];
@@ -75,9 +73,7 @@ const char *name_value;
}
void
set_name(w, new_label)
Widget w;
const char *new_label;
set_name(Widget w, const char *new_label)
{
Arg args[1];
Widget name;
@@ -88,9 +84,7 @@ const char *new_label;
}
void
set_name_width(w, new_width)
Widget w;
int new_width;
set_name_width(Widget w, int new_width)
{
Arg args[1];
Widget name;
@@ -101,8 +95,7 @@ int new_width;
}
int
get_name_width(w)
Widget w;
get_name_width(Widget w)
{
Arg args[1];
Dimension width;
@@ -115,16 +108,13 @@ Widget w;
}
Widget
get_value_widget(w)
Widget w;
get_value_widget(Widget w)
{
return XtNameToWidget(w, WVALUE);
}
void
set_value(w, new_value)
Widget w;
const char *new_value;
set_value(Widget w, const char *new_value)
{
Arg args[1];
Widget val;
@@ -135,9 +125,7 @@ const char *new_value;
}
void
set_value_width(w, new_width)
Widget w;
int new_width;
set_value_width(Widget w, int new_width)
{
Arg args[1];
Widget val;
@@ -148,8 +136,7 @@ int new_width;
}
int
get_value_width(w)
Widget w;
get_value_width(Widget w)
{
Arg args[1];
Widget val;
@@ -164,16 +151,14 @@ Widget w;
/* Swap foreground and background colors (this is the best I can do with */
/* a label widget, unless I can get some init hook in there). */
void
hilight_value(w)
Widget w;
hilight_value(Widget w)
{
swap_fg_bg(get_value_widget(w));
}
/* Swap the foreground and background colors of the given widget */
void
swap_fg_bg(w)
Widget w;
swap_fg_bg(Widget w)
{
Arg args[2];
Pixel fg, bg;