Fix for the missing ACS_S3, ACS_S7, wcolor_set() and redrawwin() with the curses driver.

This commit is contained in:
gfk
2001-11-30 23:53:16 +00:00
parent 922241de9d
commit 0b40559872
3 changed files with 99 additions and 2 deletions
+8
View File
@@ -26,6 +26,14 @@
#undef CURSES_DRV
#undef CURSES_HAS__ACS_CHAR
#undef CURSES_HAS_ACS_MAP
#undef CURSES_HAS_REDRAWWIN
#undef CURSES_HAS_WCOLOR_SET
#undef DEBUG
#undef DEFINED_ACS
+43
View File
@@ -82,6 +82,28 @@ dnl else
AC_MSG_WARN([The curses driver needs the curses (or ncurses) library.]),
)
)
AC_CURSES_ACS_ARRAY
AC_CACHE_CHECK([for redrawwin() in curses], ac_cv_curses_redrawwin,
[oldlibs="$LIBS"
LIBS="$LIBS $LIBCURSES"
AC_TRY_LINK_FUNC(redrawwin, ac_cv_curses_redrawwin=yes, ac_cv_curses_redrawwin=no)
LIBS="$oldlibs"
])
if test "$ac_cv_curses_redrawwin" = yes; then
AC_DEFINE(CURSES_HAS_REDRAWWIN)
fi
AC_CACHE_CHECK([for wcolor_set() in curses], ac_cv_curses_wcolor_set,
[oldlibs="$LIBS"
LIBS="$LIBS $LIBCURSES"
AC_TRY_LINK_FUNC(wcolor_set, ac_cv_curses_wcolor_set=yes, ac_cv_curses_wcolor_set=no)
LIBS="$oldlibs"
])
if test "$ac_cv_curses_wcolor_set" = yes; then
AC_DEFINE(CURSES_HAS_WCOLOR_SET)
fi
;;
text)
DRIVERS="$DRIVERS text.o"
@@ -176,7 +198,28 @@ AC_SUBST(DRIVERS)
])
dnl
dnl Curses test to check if we use _acs_char* or acs_map*
dnl
AC_DEFUN(AC_CURSES_ACS_ARRAY, [
AC_CACHE_CHECK([for acs_map in curses.h], ac_cv_curses_acs_map,
[AC_TRY_COMPILE([#include <curses.h>], [ char map = acs_map['p'] ], ac_cv_curses_acs_map=yes, ac_cv_curses_acs_map=no)])
if test "$ac_cv_curses_acs_map" = yes
then
AC_DEFINE(CURSES_HAS_ACS_MAP)
else
AC_CACHE_CHECK([for _acs_char in curses.h], ac_cv_curses__acs_char,
[AC_TRY_COMPILE([#include <curses.h>], [ char map = _acs_char['p'] ], ac_cv_curses__acs_char=yes, ac_cv_curses__acs_char=no)])
if test "$ac_cv_curses__acs_char" = yes
then
AC_DEFINE(CURSES_HAS__ACS_CHAR)
fi
fi
])
dnl
dnl Filesystem information detection
+48 -2
View File
@@ -6,6 +6,29 @@
*
*/
/*
Different implementations of (n)curses available on:
OpenBSD:
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libcurses/
ncurses
NetBSD:
http://cvsweb.netbsd.org/bsdweb.cgi/basesrc/lib/libcurses/
curses : does not define ACS_S3, ACS_S7, wcolor_set() or redrawwin().
it is possible to make a:
#define ACS_S3 (_acs_char['p'])
#define ACS_S7 (_acs_char['r'])
FreeBSD:
http://www.freebsd.org/cgi/cvsweb.cgi/src/
ncurses
RedHat, Debian, (most distros) Linux:
ncurses
SunOS (5.5.1):
curses : does not define ACS_S3, ACS_S7 or wcolor_set().
it is possible to make a:
#define ACS_S3 (acs_map['p'])
#define ACS_S7 (acs_map['r'])
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -39,10 +62,27 @@
// Other systems may very likely support these characters; however,
// their names were invented for ncurses.
#ifndef ACS_S3
#define ACS_S3 (acs_map['p'])
# ifdef CURSES_HAS_ACS_MAP
# define ACS_S3 (acs_map['p'])
# else
# ifdef CURSES_HAS__ACS_CHAR
# define ACS_S3 (_acs_char['p'])
# else
# define ACS_S3 ACS_S1 // Last resort
# endif
# endif
#endif
#ifndef ACS_S7
#define ACS_S7 (acs_map['r'])
# ifdef CURSES_HAS_ACS_MAP
# define ACS_S7 (acs_map['r'])
# else
# ifdef CURSES_HAS__ACS_CHAR
# define ACS_S7 (_acs_char['r'])
# else
# define ACS_S7 ACS_S9 // Last resort
# endif
# endif
#endif
lcd_logical_driver *curses_drv;
@@ -336,19 +376,23 @@ curses_drv_wborder (WINDOW *win) {
//int x, y;
//char buf[128];
#ifdef CURSES_HAS_WCOLOR_SET
if (has_colors()) {
wcolor_set(win, current_border_pair, NULL);
//wattron(win, COLOR_PAIR(current_border_pair) | A_BOLD);
wattron(win, A_BOLD);
}
#endif
box(win, 0, 0);
#ifdef CURSES_HAS_WCOLOR_SET
if (has_colors()) {
wcolor_set(win, current_color_pair, NULL);
//wattron(win, COLOR_PAIR(current_color_pair));
wattroff(win, A_BOLD);
}
#endif
}
void
@@ -681,6 +725,8 @@ void
curses_drv_restore_screen () {
erase();
refresh();
#ifdef CURSES_HAS_REDRAWWIN
redrawwin(lcd_win);
#endif
wrefresh(lcd_win);
}