* src/tty.h [USE_NCURSES]: Pull in term.h if WANT_TERM_H is defined.

(tty_tgetstr): Declare new function.
* src/tty.c [USE_NCURSES]: Request the inclusion of term.h.
(tty_tgetstr): Define new function
* src/main.c (init_xterm_support): Use tty_tgetstr().
This commit is contained in:
Pavel Tsekov 2006-05-15 13:26:18 +00:00
parent d1b8ea7e7a
commit fe251e620a
4 changed files with 31 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2006-05-15 Pavel Tsekov <ptsekov@gmx.net>
* tty.h [USE_NCURSES]: Pull in term.h if WANT_TERM_H is defined.
(tty_tgetstr): Declare new function.
* tty.c [USE_NCURSES]: Request the inclusion of term.h.
(tty_tgetstr): Define new function
* main.c (init_xterm_support): Use tty_tgetstr().
2006-05-10 Pavel Tsekov <ptsekov@gmx.net>
* user.c: Do not include subshell.h .

View File

@ -1344,9 +1344,6 @@ static void
init_xterm_support (void)
{
const char *termvalue;
#ifdef HAVE_SLANG
char *term_entry;
#endif
termvalue = getenv ("TERM");
if (!termvalue || !(*termvalue)) {
@ -1355,17 +1352,7 @@ init_xterm_support (void)
}
/* Check mouse capabilities */
#ifdef HAVE_SLANG
term_entry = SLtt_tigetent (str_unconst (termvalue));
xmouse_seq = SLtt_tigetstr ("Km", &term_entry);
#else
xmouse_seq = tigetstr ("kmous");
#endif
/* -1 means invalid capability, shouldn't happen, but let's make it 0 */
if ((long) xmouse_seq == -1) {
xmouse_seq = NULL;
}
xmouse_seq = tty_tgetstr ("Km");
if (strcmp (termvalue, "cygwin") == 0) {
force_xterm = 1;

View File

@ -32,6 +32,10 @@
#include "global.h"
#include "color.h"
#include "main.h" /* for slow_terminal */
#ifdef USE_NCURSES
#define WANT_TERM_H
#endif
#include "tty.h"
/*** file scope macro definitions **************************************/
@ -214,3 +218,16 @@ tty_printf(const char *fmt, ...)
#endif
va_end(args);
}
extern char *
tty_tgetstr (const char *cap)
{
#ifdef HAVE_SLANG
return SLtt_tgetstr (cap);
#else
{
char *unused;
return tgetstr (str_unconst (cap), &unused);
}
#endif
}

View File

@ -20,6 +20,9 @@
# else
# include <curses.h>
# endif
#ifdef WANT_TERM_H
# include <term.h>
#endif /* WANT_TERM_H */
#endif /* USE_NCURSES */
/* {{{ Input }}} */
@ -50,6 +53,8 @@ extern void tty_print_vline(int top, int left, int length);
extern void tty_print_hline(int top, int left, int length);
extern void tty_printf(const char *, ...);
extern char *tty_tgetstr (const char *name);
/* legacy interface */
#define enable_interrupt_key() tty_enable_interrupt_key()