MCPcopy Create free account
hub / github.com/NetHack/NetHack / X11_putstr

Function X11_putstr

win/X11/winX.c:968–1013  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966}
967
968void
969X11_putstr(winid window, int attr, const char *str)
970{
971 winid new_win;
972 struct xwindow *wp;
973
974 check_winid(window);
975 wp = &window_list[window];
976
977 switch (wp->type) {
978 case NHW_MESSAGE:
979 (void) strncpy(gt.toplines, str, TBUFSZ); /* for Norep(). */
980 gt.toplines[TBUFSZ - 1] = 0;
981 append_message(wp, str);
982 break;
983#ifndef STATUS_HILITES
984 case NHW_STATUS:
985 adjust_status(wp, str);
986 break;
987#endif
988 case NHW_MAP:
989 impossible("putstr: called on map window \"%s\"", str);
990 break;
991 case NHW_MENU:
992 if (wp->menu_information->is_menu) {
993 impossible("putstr: called on a menu window, \"%s\" discarded",
994 str);
995 break;
996 }
997 /*
998 * Change this menu window into a text window by creating a
999 * new text window, then copying it to this winid.
1000 */
1001 new_win = X11_create_nhwindow(NHW_TEXT);
1002 X11_destroy_nhwindow(window);
1003 *wp = window_list[new_win];
1004 window_list[new_win].type = NHW_NONE; /* allow re-use */
1005 FALLTHROUGH;
1006 /*FALLTHRU*/
1007 case NHW_TEXT:
1008 add_to_text_window(wp, attr, str);
1009 break;
1010 default:
1011 impossible("putstr: unknown window type [%d] \"%s\"", wp->type, str);
1012 }
1013}
1014
1015/* We do event processing as a callback, so this is a null routine. */
1016void

Callers 1

X11_init_nhwindowsFunction · 0.85

Calls 6

append_messageFunction · 0.85
adjust_statusFunction · 0.85
X11_create_nhwindowFunction · 0.85
X11_destroy_nhwindowFunction · 0.85
add_to_text_windowFunction · 0.85
impossibleFunction · 0.50

Tested by

no test coverage detected