patches by Rostislav Beneš: mc-40-ncursesw-old

Added support of old ncursesw library
This commit is contained in:
Slava Zanko 2008-12-29 02:01:53 +02:00
parent 8d94909d0f
commit 5d626982b0
8 changed files with 64 additions and 5 deletions

View File

@ -526,6 +526,52 @@ AC_DEFUN([MC_WITH_NCURSES], [
LIBS="$save_LIBS"
])
dnl
dnl Use the ncurses library. It can only be requested explicitly,
dnl so just fail if anything goes wrong.
dnl
dnl If ncurses exports the ESCDELAY variable it should be set to 0
dnl or you'll have to press Esc three times to dismiss a dialog box.
dnl
AC_DEFUN([MC_WITH_NCURSESW], [
dnl has_colors() is specific to ncurses, it's not in the old curses
save_LIBS="$LIBS"
LIBS=
AC_SEARCH_LIBS([has_colors], [ncursesw], [MCLIBS="$MCLIBS $LIBS"],
[AC_MSG_ERROR([Cannot find ncursesw library])])
dnl Check the header
ncurses_h_found=
AC_CHECK_HEADERS([ncursesw/curses.h],
[ncursesw_h_found=yes; break])
if test -z "$ncursesw_h_found"; then
AC_MSG_ERROR([Cannot find ncursesw header file])
fi
screen_type=ncursesw
screen_msg="ncursesw library"
AC_DEFINE(USE_NCURSESW, 1,
[Define to use ncursesw for screen management])
AC_CACHE_CHECK([for ESCDELAY variable],
[mc_cv_ncursesw_escdelay],
[AC_TRY_LINK([], [
extern int ESCDELAY;
ESCDELAY = 0;
],
[mc_cv_ncursesw_escdelay=yes],
[mc_cv_ncursesw_escdelay=no])
])
if test "$mc_cv_ncursesw_escdelay" = yes; then
AC_DEFINE(HAVE_ESCDELAY, 1,
[Define if ncursesw has ESCDELAY variable])
fi
AC_CHECK_FUNCS(resizeterm)
LIBS="$save_LIBS"
])
dnl
dnl Check for ext2fs recovery code

View File

@ -455,8 +455,8 @@ dnl
dnl Select the screen library. mcslang is the included S-Lang library.
dnl
AC_ARG_WITH(screen,
[ --with-screen=LIB Compile with screen library: slang, mcslang or
ncurses [[slang if found, else mcslang]]])
[ --with-screen=LIB Compile with screen library: slang, mcslang,
ncurses or ncursesw [[slang if found, else mcslang]]])
case x$with_screen in
xslang)
@ -468,6 +468,9 @@ xmcslang)
xncurses)
MC_WITH_NCURSES
;;
xncursesw)
MC_WITH_NCURSESW
;;
x)
MC_WITH_SLANG
;;

View File

@ -816,7 +816,7 @@ int get_key_code (int no_delay)
nodelay (stdscr, TRUE);
}
c = getch ();
#if defined(USE_NCURSES) && defined(KEY_RESIZE)
#if (defined(USE_NCURSES) || defined(USE_NCURSESW)) && defined(KEY_RESIZE)
if (c == KEY_RESIZE)
goto nodelay_try_again;
#endif

View File

@ -724,7 +724,7 @@ setup_panels (void)
void flag_winch (int dummy)
{
(void) dummy;
#ifndef USE_NCURSES /* don't do malloc in a signal handler */
#if !(defined(USE_NCURSES) || defined(USE_NCURSESW)) /* don't do malloc in a signal handler */
low_level_change_screen_size ();
#endif
winch_flag = 1;

View File

@ -74,6 +74,8 @@ static const char *const features[] = {
#elif defined(USE_NCURSES)
N_("Using the ncurses library"),
#elif defined(USE_NCURSESW)
N_("Using the ncursesw library"),
#else
#error "Cannot compile mc without S-Lang or ncurses"
#endif /* !HAVE_SLANG && !USE_NCURSES */

View File

@ -34,7 +34,7 @@
#include "main.h" /* for slow_terminal */
#include "strutil.h"
#ifdef USE_NCURSES
#if defined(USE_NCURSES) || defined(USE_NCURSESW)
#define WANT_TERM_H
#endif
#include "tty.h"

View File

@ -27,6 +27,13 @@
#endif /* WANT_TERM_H */
#endif /* USE_NCURSES */
#ifdef USE_NCURSESW
# include <ncursesw/curses.h>
#ifdef WANT_TERM_H
# include <term.h>
#endif
#endif
/* {{{ Input }}} */
extern void tty_enable_interrupt_key(void);

View File

@ -26,6 +26,7 @@
#include <sys/types.h>
#undef USE_NCURSES /* Don't include *curses.h */
#undef USE_NCURSESW
#include "../src/global.h"
#include "../src/tty.h" /* enable/disable interrupt key */
#include "../src/wtools.h" /* message() */