From 537b7b5e9f71cb57a690d903d1787d119eaa29d0 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 17 Mar 2015 02:06:47 +0100 Subject: support for ncurses/win32 Unfortunately, I cannot really test this curses port since it is not supported by Windows 2000 (missing AttachConsole() API) and it does not run very well in Wine. Under Wine, it does not require the LINES and COLS variable to be set. However, endwin() and the refresh later on result in a very unusable state of operation. I cannot currently check whether this is true on Windows XP or later. --- src/interface-curses.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/interface-curses.cpp') diff --git a/src/interface-curses.cpp b/src/interface-curses.cpp index 0c08ec9..d12aed4 100644 --- a/src/interface-curses.cpp +++ b/src/interface-curses.cpp @@ -63,6 +63,13 @@ #define PDCURSES_WIN32 #endif +/** + * Whether we're on ncurses/win32 console + */ +#if defined(NCURSES_VERSION) && defined(G_OS_WIN32) +#define NCURSES_WIN32 +#endif + namespace SciTECO { extern "C" { @@ -141,6 +148,11 @@ InterfaceCurses::init_batch(void) PDC_set_resize_limits(25, 0xFFFF, 80, 0xFFFF); #endif +#ifdef NCURSES_WIN32 + /* $TERM must be unset for the win32 driver to load */ + g_unsetenv("TERM"); +#endif + /* * PDCurses cannot support terminal redirection * into files, nor can it support multiple terminals. @@ -290,7 +302,7 @@ InterfaceCurses::set_window_title(const gchar *title) PDC_set_title(title); } -#elif defined(HAVE_TIGETSTR) +#elif defined(HAVE_TIGETSTR) && defined(G_OS_UNIX) void InterfaceCurses::set_window_title(const gchar *title) @@ -299,8 +311,8 @@ InterfaceCurses::set_window_title(const gchar *title) * NOTE: terminfo variables in term.h interfere with * the rest of our code */ - const char *tsl = tigetstr("tsl"); - const char *fsl = tigetstr("fsl"); + const char *tsl = tigetstr((char *)"tsl"); + const char *fsl = tigetstr((char *)"fsl"); if (!tsl || !fsl) return; -- cgit v1.2.3