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

Function tty_init_nhwindows

win/tty/wintty.c:510–593  ·  view source on GitHub ↗

ARGSUSED*/

Source from the content-addressed store, hash-verified

508
509/*ARGSUSED*/
510void
511tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
512{
513 int wid, hgt, i;
514
515 /* options aren't processed yet so wc2_statuslines might be 0;
516 make sure that it has a reasonable value during tty setup */
517 iflags.wc2_statuslines = StatusRows(); /* 2 or 3; 0 => 2 */
518 /*
519 * Remember tty modes, to be restored on exit.
520 *
521 * gettty() must be called before term_startup()
522 * due to ordering of LI/CO settings
523 * term_startup() must be called before initoptions()
524 * due to ordering of graphics settings
525 */
526#if defined(UNIX) || defined(VMS)
527 setbuf(stdout, obuf);
528#endif
529 gettty();
530
531 /* to port dependant tty setup */
532 term_startup(&wid, &hgt);
533 setftty(); /* calls term_start_screen */
534 term_curs_set(0);
535
536 /* set up tty descriptor */
537 ttyDisplay = (struct DisplayDesc *) alloc(sizeof (struct DisplayDesc));
538 ttyDisplay->toplin = TOPLINE_EMPTY;
539 ttyDisplay->topl_utf8 = 0; /* putmixed may set this */
540 ttyDisplay->rows = hgt;
541 ttyDisplay->cols = wid;
542 ttyDisplay->curx = ttyDisplay->cury = 0;
543 ttyDisplay->inmore = ttyDisplay->inread = ttyDisplay->intr = 0;
544 ttyDisplay->dismiss_more = 0;
545 ttyDisplay->color = NO_COLOR;
546 ttyDisplay->attrs = 0;
547 ttyDisplay->topl_utf8 = 0;
548 ttyDisplay->mixed = 0;
549
550 /* set up the default windows */
551 BASE_WINDOW = tty_create_nhwindow(NHW_BASE);
552 wins[BASE_WINDOW]->active = 1;
553
554 ttyDisplay->lastwin = WIN_ERR;
555
556#ifdef RESIZABLE
557 (void) signal(SIGWINCH, (SIG_RET_TYPE) winch_handler);
558#endif
559
560 tty_clear_nhwindow(BASE_WINDOW);
561
562 /* Once pline() is functional, error-related prompts such as
563 * those relating to save files etc. can intrude on the
564 * copyright information display because their prompts are
565 * up at the very top in the message window.
566 * Move the copyright information a little further down to
567 * row 3, out of the way. */

Callers 1

mac_init_nhwindowsFunction · 0.85

Calls 12

tty_create_nhwindowFunction · 0.85
tty_clear_nhwindowFunction · 0.85
tty_cursFunction · 0.85
tty_putstrFunction · 0.85
copyright_banner_lineFunction · 0.85
tty_display_nhwindowFunction · 0.85
term_startupFunction · 0.70
term_curs_setFunction · 0.70
getttyFunction · 0.50
setfttyFunction · 0.50
allocFunction · 0.50

Tested by

no test coverage detected