diff --git a/include/winX.h b/include/winX.h index 32af1364b..3fe217107 100644 --- a/include/winX.h +++ b/include/winX.h @@ -394,6 +394,8 @@ E void FDECL(hilight_value, (Widget)); E void FDECL(swap_fg_bg, (Widget)); /* external declarations */ +E char *FDECL(X11_getmsghistory, (BOOLEAN_P)); +E void FDECL(X11_putmsghistory, (const char *, BOOLEAN_P)); E void FDECL(X11_init_nhwindows, (int *, char **)); E void NDECL(X11_player_selection); E void NDECL(X11_askname); diff --git a/win/X11/winX.c b/win/X11/winX.c index 009f4e6ab..834937e93 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -133,7 +133,7 @@ struct window_procs X11_procs = { #else genl_outrip, #endif - X11_preference_update, genl_getmsghistory, genl_putmsghistory, + X11_preference_update, X11_getmsghistory, X11_putmsghistory, genl_status_init, genl_status_finish, genl_status_enablefield, genl_status_update, genl_can_suspend_no, /* XXX may not always be correct */ @@ -181,6 +181,43 @@ static winid message_win = WIN_ERR, /* These are the winids of the message, */ status_win = WIN_ERR; /* are created in init_windows(). */ static Pixmap icon_pixmap = None; /* Pixmap for icon. */ +void +X11_putmsghistory(msg, is_restoring) +const char *msg; +boolean is_restoring; +{ + if (WIN_MESSAGE != WIN_ERR) { + struct xwindow *wp = &window_list[WIN_MESSAGE]; + debugpline2("X11_putmsghistory('%s',%i)", msg, is_restoring); + if (msg) + append_message(wp, msg); + } +} + +char * +X11_getmsghistory(init) +boolean init; +{ + if (WIN_MESSAGE != WIN_ERR) { + static struct line_element *curr = (struct line_element *) 0; + static int numlines = 0; + struct xwindow *wp = &window_list[WIN_MESSAGE]; + + if (!curr) { + curr = wp->mesg_information->head; + numlines = 0; + } + + if (numlines < wp->mesg_information->num_lines) { + curr = curr->next; + numlines++; + debugpline2("X11_getmsghistory(%i)='%s'", init, curr->line); + return curr->line; + } + } + return (char *) 0; +} + /* * Find the window structure that corresponds to the given widget. Note * that this is not the popup widget, nor the viewport, but the child.