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

Function X11_create_nhwindow

win/X11/winX.c:1041–1133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1039}
1040
1041winid
1042X11_create_nhwindow(int type)
1043{
1044 winid window;
1045 struct xwindow *wp;
1046
1047 if (!x_inited)
1048 panic("create_nhwindow: windows not initialized");
1049
1050#ifdef X11_HANGUP_SIGNAL
1051 /* set up our own signal handlers on the first call. Can't do this in
1052 * X11_init_nhwindows because unixmain sets its handler after calling
1053 * all the init routines. */
1054 if (X11_sig_id == 0) {
1055 X11_sig_id = XtAppAddSignal(app_context, X11_sig_cb, (XtPointer) 0);
1056#ifdef SA_RESTART
1057 {
1058 struct sigaction sact;
1059
1060 (void) memset((char *) &sact, 0, sizeof(struct sigaction));
1061 sact.sa_handler = (SIG_RET_TYPE) X11_sig;
1062 (void) sigaction(SIGHUP, &sact, (struct sigaction *) 0);
1063#ifdef SIGXCPU
1064 (void) sigaction(SIGXCPU, &sact, (struct sigaction *) 0);
1065#endif
1066 }
1067#else
1068 (void) signal(SIGHUP, (SIG_RET_TYPE) X11_sig);
1069#ifdef SIGXCPU
1070 (void) signal(SIGXCPU, (SIG_RET_TYPE) X11_sig);
1071#endif
1072#endif
1073 }
1074#endif
1075
1076 /*
1077 * We have already created the standard message, map, and status
1078 * windows in the window init routine. The first window of that
1079 * type to be created becomes the standard.
1080 *
1081 * A better way to do this would be to say that init_nhwindows()
1082 * has already defined these three windows.
1083 */
1084 if (type == NHW_MAP && map_win != WIN_ERR) {
1085 window = map_win;
1086 map_win = WIN_ERR;
1087 return window;
1088 }
1089 if (type == NHW_MESSAGE && message_win != WIN_ERR) {
1090 window = message_win;
1091 message_win = WIN_ERR;
1092 return window;
1093 }
1094 if (type == NHW_STATUS && status_win != WIN_ERR) {
1095 window = status_win;
1096 status_win = WIN_ERR;
1097 return window;
1098 }

Callers 3

X11_putstrFunction · 0.85
X11_display_fileFunction · 0.85
X11_select_menuFunction · 0.85

Calls 8

find_free_windowFunction · 0.85
create_map_windowFunction · 0.85
create_message_windowFunction · 0.85
create_status_windowFunction · 0.85
create_menu_windowFunction · 0.85
create_text_windowFunction · 0.85
sigactionClass · 0.70
panicFunction · 0.50

Tested by

no test coverage detected