some tty updates
Add a note about NO_TERMS to include/wintty.h for clarity. Rename tty_startup and tty_shutdown to term_startup() and term_shutdown(). They are found in termcap.c for !NO_TERMS like most of the other term_ routines, as well as having versions for several of the NO_TERMS platforms. They aren't part of the tty_interface called from the core. The tty implementation does call and rely on them. Remove some conditional #ifdef's around term_shutdown() (formerly tty_shutdown()) and just ensure that all the tty platforms have an implementation that they can link with, even if it is just a stub presently. Put the protype for nethack_exit in extern.h to reduce maintenance to a single spot, and remove it from other locations. A warning in the msdos cross-compile led to this change.
This commit is contained in:
@@ -1079,7 +1079,7 @@ setftty(void)
|
||||
}
|
||||
|
||||
void
|
||||
tty_startup(int *wid, int *hgt)
|
||||
term_startup(int *wid, int *hgt)
|
||||
{
|
||||
*wid = console.width;
|
||||
*hgt = console.height;
|
||||
@@ -1092,6 +1092,36 @@ tty_number_pad(int state UNUSED)
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/* stub tcap replacements for linkage from wintty.c */
|
||||
|
||||
void
|
||||
term_shutdown(void)
|
||||
{
|
||||
consoletty_exit();
|
||||
}
|
||||
|
||||
#ifdef ASCIIGRAPH
|
||||
void
|
||||
graph_on(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
graph_off(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
tty_end_screen(void)
|
||||
{
|
||||
term_clear_screen();
|
||||
really_move_cursor();
|
||||
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
|
||||
back_buffer_flip();
|
||||
FlushConsoleInputBuffer(console.hConIn);
|
||||
}
|
||||
|
||||
void
|
||||
tty_start_screen(void)
|
||||
{
|
||||
@@ -1107,16 +1137,6 @@ tty_start_screen(void)
|
||||
#endif /* VIRTUAL_TERMINAL_SEQUENCES */
|
||||
}
|
||||
|
||||
void
|
||||
tty_end_screen(void)
|
||||
{
|
||||
term_clear_screen();
|
||||
really_move_cursor();
|
||||
buffer_fill_to_end(console.back_buffer, &clear_cell, 0, 0);
|
||||
back_buffer_flip();
|
||||
FlushConsoleInputBuffer(console.hConIn);
|
||||
}
|
||||
|
||||
static BOOL
|
||||
CtrlHandler(DWORD ctrltype)
|
||||
{
|
||||
@@ -1251,6 +1271,7 @@ console_poskey(coordxy *x, coordxy *y, int *mod)
|
||||
if (gc.Cmd.swap_yz)
|
||||
numberpad |= 0x10;
|
||||
#endif
|
||||
term_curs_set(1);
|
||||
ch = (program_state.done_hup)
|
||||
? '\033'
|
||||
: keyboard_handling.pCheckInput(
|
||||
@@ -1262,6 +1283,7 @@ console_poskey(coordxy *x, coordxy *y, int *mod)
|
||||
*x = cc.x;
|
||||
*y = cc.y;
|
||||
}
|
||||
term_curs_set(0);
|
||||
return ch;
|
||||
}
|
||||
|
||||
@@ -1462,7 +1484,7 @@ xputc_core(int ch)
|
||||
*/
|
||||
#endif
|
||||
void
|
||||
g_putch(int in_ch)
|
||||
console_g_putch(int in_ch)
|
||||
{
|
||||
unsigned char ch;
|
||||
cell_t cell;
|
||||
@@ -1644,6 +1666,25 @@ term_clear_screen(void)
|
||||
home();
|
||||
}
|
||||
|
||||
void
|
||||
term_curs_set(int visibility)
|
||||
{
|
||||
static int vis = -1;
|
||||
|
||||
if (vis == visibility)
|
||||
return;
|
||||
|
||||
static CONSOLE_CURSOR_INFO cursorinfo = { 0, 0 };
|
||||
|
||||
if (!cursorinfo.dwSize) {
|
||||
GetConsoleCursorInfo(console.hConOut, &cursorinfo);
|
||||
vis = cursorinfo.bVisible ? 1 : 0;
|
||||
}
|
||||
cursorinfo.bVisible = visibility ? (BOOL) TRUE : (BOOL) FALSE;
|
||||
SetConsoleCursorInfo(console.hConOut, &cursorinfo);
|
||||
vis = visibility;
|
||||
}
|
||||
|
||||
void
|
||||
home(void)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@ char *translate_path_variables(const char *, char *);
|
||||
char *exename(void);
|
||||
boolean fakeconsole(void);
|
||||
void freefakeconsole(void);
|
||||
ATTRNORETURN extern void nethack_exit(int) NORETURN;
|
||||
#if defined(MSWIN_GRAPHICS)
|
||||
extern void mswin_destroy_reg(void);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user