mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
optionally disable the curses server console, bringing back the old behaviour
This commit is contained in:
parent
a771b5bd6c
commit
5e81d80d8c
2 changed files with 44 additions and 11 deletions
27
configure.in
27
configure.in
|
@ -92,7 +92,7 @@ AC_HEADER_STDC
|
|||
AC_HEADER_MAJOR
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS(
|
||||
arpa/inet.h asm/io.h assert.h conio.h ctype.h curses.h ddraw.h dinput.h \
|
||||
arpa/inet.h asm/io.h assert.h conio.h ctype.h ddraw.h dinput.h \
|
||||
direct.h dirent.h dlfcn.h dmedia/audio.h dmedia/cdaudio.h dpmi.h \
|
||||
dsound.h errno.h fcntl.h fnmatch.h glide/sst1vid.h io.h \
|
||||
libc.h limits.h linux/cdrom.h linux/joystick.h linux/soundcard.h \
|
||||
|
@ -270,16 +270,25 @@ if test "x$ac_cv_func_dlopen" != "xyes"; then
|
|||
fi
|
||||
AC_SUBST(DL_LIBS)
|
||||
|
||||
AC_CHECK_LIB(ncurses, initscr,
|
||||
CURSES_LIBS=-lncurses,
|
||||
AC_CHECK_LIB(pdcurses, initscr,
|
||||
CURSES_LIBS=-lpdcurses,
|
||||
AC_CHECK_LIB(curses, initscr,
|
||||
CURSES_LIBS=-lcurses,
|
||||
CURSES_LIBS=
|
||||
AC_ARG_ENABLE(curses,
|
||||
[ --disable-curses disable curses support]
|
||||
)
|
||||
|
||||
if test "x$enable_curses" != "xno"; then
|
||||
AC_CHECK_HEADERS(curses.h)
|
||||
AC_CHECK_LIB(ncurses, initscr,
|
||||
CURSES_LIBS=-lncurses,
|
||||
AC_CHECK_LIB(pdcurses, initscr,
|
||||
CURSES_LIBS=-lpdcurses,
|
||||
AC_CHECK_LIB(curses, initscr,
|
||||
CURSES_LIBS=-lcurses,
|
||||
CURSES_LIBS=
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
CURSES_LIBS=
|
||||
fi
|
||||
AC_SUBST(CURSES_LIBS)
|
||||
|
||||
dnl Checks for stricmp/strcasecmp
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
#include "server.h"
|
||||
|
||||
#ifdef HAVE_CURSES_H
|
||||
static WINDOW *output;
|
||||
static WINDOW *status;
|
||||
static WINDOW *input;
|
||||
|
@ -90,10 +91,12 @@ static const byte attr_map[256] = {
|
|||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
void
|
||||
Con_Init (const char *plugin_name)
|
||||
{
|
||||
#ifdef HAVE_CURSES_H
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
|
@ -138,20 +141,24 @@ Con_Init (const char *plugin_name)
|
|||
wrefresh (output);
|
||||
wrefresh (status);
|
||||
wrefresh (input);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Con_Shutdown (void)
|
||||
{
|
||||
#ifdef HAVE_CURSES_H
|
||||
endwin ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Con_Print (const char *txt)
|
||||
{
|
||||
chtype ch;
|
||||
|
||||
#ifdef HAVE_CURSES_H
|
||||
if (output) {
|
||||
chtype ch;
|
||||
|
||||
while ((ch = (byte)*txt++)) {
|
||||
ch = sys_char_map[ch] | attr_table[attr_map[ch]];
|
||||
waddch (output, ch);
|
||||
|
@ -159,16 +166,21 @@ Con_Print (const char *txt)
|
|||
touchwin (stdscr);
|
||||
wrefresh (output);
|
||||
} else {
|
||||
#endif
|
||||
int ch;
|
||||
while ((ch = (byte)*txt++)) {
|
||||
ch = sys_char_map[ch];
|
||||
putchar (ch);
|
||||
}
|
||||
#ifdef HAVE_CURSES_H
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Con_ProcessInput (inputline_t *il, int ch)
|
||||
{
|
||||
#ifdef HAVE_CURSES_H
|
||||
int i;
|
||||
int curs_x;
|
||||
char *text = 0;
|
||||
|
@ -302,8 +314,19 @@ Con_ProcessInput (inputline_t *il, int ch)
|
|||
wmove (input, 0, curs_x);
|
||||
touchline (stdscr, screen_y - 1, 1);
|
||||
wrefresh (input);
|
||||
#else
|
||||
const char *cmd;
|
||||
|
||||
while (1) {
|
||||
cmd = Sys_ConsoleInput ();
|
||||
if (!cmd)
|
||||
break;
|
||||
Cbuf_AddText (cmd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_CURSES_H
|
||||
/*
|
||||
Con_CompleteCommandLine
|
||||
|
||||
|
@ -403,3 +426,4 @@ Con_CompleteCommandLine (void)
|
|||
if (list[i])
|
||||
free (list[i]);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue