Browse Source

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

Added support of old ncursesw library
Slava Zanko 16 years ago
parent
commit
5d626982b0
8 changed files with 64 additions and 5 deletions
  1. 46 0
      acinclude.m4
  2. 5 2
      configure.ac
  3. 1 1
      src/key.c
  4. 1 1
      src/layout.c
  5. 2 0
      src/textconf.c
  6. 1 1
      src/tty.c
  7. 7 0
      src/tty.h
  8. 1 0
      vfs/smbfs.c

+ 46 - 0
acinclude.m4

@@ -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

+ 5 - 2
configure.ac

@@ -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
 	;;

+ 1 - 1
src/key.c

@@ -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

+ 1 - 1
src/layout.c

@@ -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;

+ 2 - 0
src/textconf.c

@@ -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 */

+ 1 - 1
src/tty.c

@@ -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"

+ 7 - 0
src/tty.h

@@ -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);

+ 1 - 0
vfs/smbfs.c

@@ -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() */