Add Sun Microsystems workstation console support

This commit is contained in:
Markus Gans 2017-12-14 00:35:10 +01:00
parent fd75f5af42
commit c10a88008c
12 changed files with 272 additions and 93 deletions

View File

@ -1,3 +1,6 @@
2017-12-14 Markus Gans <guru.mail@muenster.de>
* Add Sun Microsystems workstation console support
2017-12-10 Markus Gans <guru.mail@muenster.de> 2017-12-10 Markus Gans <guru.mail@muenster.de>
* Refactoring of the FMenu mouse event handler * Refactoring of the FMenu mouse event handler

View File

@ -15,6 +15,15 @@
/* Define to 1 if you have the <fcntl.h> header file. */ /* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define to 1 if you have the `getttynam' function. */
#undef HAVE_GETTTYNAM
/* Define to 1 if you have the `getuid' function. */
#undef HAVE_GETUID
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
@ -39,18 +48,27 @@
/* Define to 1 if you have the <queue> header file. */ /* Define to 1 if you have the <queue> header file. */
#undef HAVE_QUEUE #undef HAVE_QUEUE
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the <stdint.h> header file. */ /* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H #undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */ /* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H #undef HAVE_STDLIB_H
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the <strings.h> header file. */ /* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H #undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H #undef HAVE_STRING_H
/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR
/* Define to 1 if you have the <sys/io.h> header file. */ /* Define to 1 if you have the <sys/io.h> header file. */
#undef HAVE_SYS_IO_H #undef HAVE_SYS_IO_H
@ -72,12 +90,18 @@
/* Define to 1 if you have the <term.h> header file. */ /* Define to 1 if you have the <term.h> header file. */
#undef HAVE_TERM_H #undef HAVE_TERM_H
/* Define to 1 if you have the <ttyent.h> header file. */
#undef HAVE_TTYENT_H
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define to 1 if you have the <vector> header file. */ /* Define to 1 if you have the <vector> header file. */
#undef HAVE_VECTOR #undef HAVE_VECTOR
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to the sub-directory in which libtool stores uninstalled libraries. /* Define to the sub-directory in which libtool stores uninstalled libraries.
*/ */
#undef LT_OBJDIR #undef LT_OBJDIR

22
configure vendored
View File

@ -4799,6 +4799,7 @@ for ac_header in \
langinfo.h \ langinfo.h \
term.h \ term.h \
termios.h \ termios.h \
ttyent.h \
unistd.h \ unistd.h \
cmath \ cmath \
csignal \ csignal \
@ -4820,6 +4821,27 @@ fi
done done
# Checks for library functions.
for ac_func in \
getuid \
geteuid \
getttynam \
select \
strdup \
strstr \
vsnprintf
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
# Checks for 'tgetent' # Checks for 'tgetent'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
$as_echo_n "checking for library containing tgetent... " >&6; } $as_echo_n "checking for library containing tgetent... " >&6; }

View File

@ -24,6 +24,7 @@ AC_CHECK_HEADERS( \
langinfo.h \ langinfo.h \
term.h \ term.h \
termios.h \ termios.h \
ttyent.h \
unistd.h \ unistd.h \
cmath \ cmath \
csignal \ csignal \
@ -33,6 +34,16 @@ AC_CHECK_HEADERS( \
queue \ queue \
vector) vector)
# Checks for library functions.
AC_CHECK_FUNCS( \
getuid \
geteuid \
getttynam \
select \
strdup \
strstr \
vsnprintf )
# Checks for 'tgetent' # Checks for 'tgetent'
AC_SEARCH_LIBS([tgetent], [termcap tinfo curses ncurses]) AC_SEARCH_LIBS([tgetent], [termcap tinfo curses ncurses])
# Checks for 'tparm' # Checks for 'tparm'

View File

@ -320,9 +320,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign doc/Makefile $(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \

View File

@ -411,9 +411,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign examples/Makefile $(AUTOMAKE) --gnu examples/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \

View File

@ -264,9 +264,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign fonts/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu fonts/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign fonts/Makefile $(AUTOMAKE) --gnu fonts/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \

View File

@ -24,6 +24,21 @@
#define F_HAVE_FCNTL_H 1 #define F_HAVE_FCNTL_H 1
#endif #endif
/* Define to 1 if you have the `geteuid' function. */
#ifndef F_HAVE_GETEUID
#define F_HAVE_GETEUID 1
#endif
/* Define to 1 if you have the `getttynam' function. */
#ifndef F_HAVE_GETTTYNAM
#define F_HAVE_GETTTYNAM 1
#endif
/* Define to 1 if you have the `getuid' function. */
#ifndef F_HAVE_GETUID
#define F_HAVE_GETUID 1
#endif
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#ifndef F_HAVE_INTTYPES_H #ifndef F_HAVE_INTTYPES_H
#define F_HAVE_INTTYPES_H 1 #define F_HAVE_INTTYPES_H 1
@ -58,6 +73,11 @@
/* Define to 1 if you have the <queue> header file. */ /* Define to 1 if you have the <queue> header file. */
/* #undef HAVE_QUEUE */ /* #undef HAVE_QUEUE */
/* Define to 1 if you have the `select' function. */
#ifndef F_HAVE_SELECT
#define F_HAVE_SELECT 1
#endif
/* Define to 1 if you have the <stdint.h> header file. */ /* Define to 1 if you have the <stdint.h> header file. */
#ifndef F_HAVE_STDINT_H #ifndef F_HAVE_STDINT_H
#define F_HAVE_STDINT_H 1 #define F_HAVE_STDINT_H 1
@ -68,6 +88,11 @@
#define F_HAVE_STDLIB_H 1 #define F_HAVE_STDLIB_H 1
#endif #endif
/* Define to 1 if you have the `strdup' function. */
#ifndef F_HAVE_STRDUP
#define F_HAVE_STRDUP 1
#endif
/* Define to 1 if you have the <strings.h> header file. */ /* Define to 1 if you have the <strings.h> header file. */
#ifndef F_HAVE_STRINGS_H #ifndef F_HAVE_STRINGS_H
#define F_HAVE_STRINGS_H 1 #define F_HAVE_STRINGS_H 1
@ -78,6 +103,11 @@
#define F_HAVE_STRING_H 1 #define F_HAVE_STRING_H 1
#endif #endif
/* Define to 1 if you have the `strstr' function. */
#ifndef F_HAVE_STRSTR
#define F_HAVE_STRSTR 1
#endif
/* Define to 1 if you have the <sys/io.h> header file. */ /* Define to 1 if you have the <sys/io.h> header file. */
#ifndef F_HAVE_SYS_IO_H #ifndef F_HAVE_SYS_IO_H
#define F_HAVE_SYS_IO_H 1 #define F_HAVE_SYS_IO_H 1
@ -113,6 +143,11 @@
#define F_HAVE_TERM_H 1 #define F_HAVE_TERM_H 1
#endif #endif
/* Define to 1 if you have the <ttyent.h> header file. */
#ifndef F_HAVE_TTYENT_H
#define F_HAVE_TTYENT_H 1
#endif
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#ifndef F_HAVE_UNISTD_H #ifndef F_HAVE_UNISTD_H
#define F_HAVE_UNISTD_H 1 #define F_HAVE_UNISTD_H 1
@ -121,6 +156,11 @@
/* Define to 1 if you have the <vector> header file. */ /* Define to 1 if you have the <vector> header file. */
/* #undef HAVE_VECTOR */ /* #undef HAVE_VECTOR */
/* Define to 1 if you have the `vsnprintf' function. */
#ifndef F_HAVE_VSNPRINTF
#define F_HAVE_VSNPRINTF 1
#endif
/* Define to the sub-directory in which libtool stores uninstalled libraries. /* Define to the sub-directory in which libtool stores uninstalled libraries.
*/ */
#ifndef F_LT_OBJDIR #ifndef F_LT_OBJDIR

View File

@ -85,7 +85,12 @@
#include <langinfo.h> #include <langinfo.h>
#include <term.h> // termcap #include <term.h> // termcap
#include <termios.h> #include <termios.h>
#include <ttyent.h>
#if F_HAVE_GETTTYNAM && F_HAVE_TTYENT_H
#include <ttyent.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <clocale> #include <clocale>
@ -188,6 +193,7 @@ class FTerm
static bool isGnomeTerminal(); static bool isGnomeTerminal();
static bool isKtermTerminal(); static bool isKtermTerminal();
static bool isTeraTerm(); static bool isTeraTerm();
static bool isSunTerminal();
static bool isCygwinTerminal(); static bool isCygwinTerminal();
static bool isMinttyTerm(); static bool isMinttyTerm();
static bool isLinuxTerm(); static bool isLinuxTerm();
@ -479,6 +485,7 @@ class FTerm
static void init_termcaps_vte_quirks(); static void init_termcaps_vte_quirks();
static void init_termcaps_putty_quirks(); static void init_termcaps_putty_quirks();
static void init_termcaps_teraterm_quirks(); static void init_termcaps_teraterm_quirks();
static void init_termcaps_sun_quirks();
static void init_termcaps_screen_quirks(); static void init_termcaps_screen_quirks();
static void init_termcaps_general_quirks(); static void init_termcaps_general_quirks();
static void init_termcaps_keys (char*&); static void init_termcaps_keys (char*&);
@ -531,6 +538,7 @@ class FTerm
static bool gnome_terminal; static bool gnome_terminal;
static bool kterm_terminal; static bool kterm_terminal;
static bool tera_terminal; static bool tera_terminal;
static bool sun_terminal;
static bool cygwin_terminal; static bool cygwin_terminal;
static bool mintty_terminal; static bool mintty_terminal;
static bool linux_terminal; static bool linux_terminal;
@ -545,6 +553,7 @@ class FTerm
static FRect* term; // current terminal geometry static FRect* term; // current terminal geometry
static FPoint* mouse; // mouse click position static FPoint* mouse; // mouse click position
static int gnome_terminal_id;
static int stdin_status_flags; static int stdin_status_flags;
static int fd_tty; static int fd_tty;
static uInt baudrate; static uInt baudrate;
@ -674,6 +683,10 @@ inline bool FTerm::isKtermTerminal()
inline bool FTerm::isTeraTerm() inline bool FTerm::isTeraTerm()
{ return tera_terminal; } { return tera_terminal; }
//----------------------------------------------------------------------
inline bool FTerm::isSunTerminal()
{ return sun_terminal; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FTerm::isCygwinTerminal() inline bool FTerm::isCygwinTerminal()
{ return cygwin_terminal; } { return cygwin_terminal; }

View File

@ -438,9 +438,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile $(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \

View File

@ -49,6 +49,7 @@ int (*FTerm::Fputchar)(int);
int FTerm::stdin_no; int FTerm::stdin_no;
int FTerm::stdout_no; int FTerm::stdout_no;
int FTerm::fd_tty; int FTerm::fd_tty;
int FTerm::gnome_terminal_id;
int FTerm::stdin_status_flags; int FTerm::stdin_status_flags;
int FTerm::erase_ch_length; int FTerm::erase_ch_length;
int FTerm::repeat_char_length; int FTerm::repeat_char_length;
@ -76,6 +77,7 @@ bool FTerm::kde_konsole;
bool FTerm::gnome_terminal; bool FTerm::gnome_terminal;
bool FTerm::kterm_terminal; bool FTerm::kterm_terminal;
bool FTerm::tera_terminal; bool FTerm::tera_terminal;
bool FTerm::sun_terminal;
bool FTerm::cygwin_terminal; bool FTerm::cygwin_terminal;
bool FTerm::mintty_terminal; bool FTerm::mintty_terminal;
bool FTerm::linux_terminal; bool FTerm::linux_terminal;
@ -1191,6 +1193,9 @@ void FTerm::resetXTermColors()
{ {
// Reset the entire color table // Reset the entire color table
if ( gnome_terminal && gnome_terminal_id < 3502 )
return;
if ( putty_terminal ) if ( putty_terminal )
return; return;
@ -1208,6 +1213,9 @@ void FTerm::resetXTermForeground()
{ {
// Reset the VT100 text foreground color // Reset the VT100 text foreground color
if ( gnome_terminal && gnome_terminal_id < 3502 )
return;
if ( putty_terminal ) if ( putty_terminal )
return; return;
@ -1225,6 +1233,9 @@ void FTerm::resetXTermBackground()
{ {
// Reset the VT100 text background color // Reset the VT100 text background color
if ( gnome_terminal && gnome_terminal_id < 3502 )
return;
if ( putty_terminal ) if ( putty_terminal )
return; return;
@ -1242,6 +1253,9 @@ void FTerm::resetXTermCursorColor()
{ {
// Reset the text cursor color // Reset the text cursor color
if ( gnome_terminal && gnome_terminal_id < 3502 )
return;
if ( putty_terminal ) if ( putty_terminal )
return; return;
@ -1259,6 +1273,9 @@ void FTerm::resetXTermMouseForeground()
{ {
// Reset the mouse foreground color // Reset the mouse foreground color
if ( gnome_terminal && gnome_terminal_id < 3502 )
return;
if ( putty_terminal ) if ( putty_terminal )
return; return;
@ -1276,6 +1293,9 @@ void FTerm::resetXTermMouseBackground()
{ {
// Reset the mouse background color // Reset the mouse background color
if ( gnome_terminal && gnome_terminal_id < 3502 )
return;
if ( putty_terminal ) if ( putty_terminal )
return; return;
@ -1293,6 +1313,9 @@ void FTerm::resetXTermHighlightBackground()
{ {
// Reset the highlight background color // Reset the highlight background color
if ( gnome_terminal && gnome_terminal_id < 3502 )
return;
if ( putty_terminal ) if ( putty_terminal )
return; return;
@ -2198,6 +2221,8 @@ void FTerm::getSystemTermType()
std::fclose(fp); std::fclose(fp);
} }
#if F_HAVE_GETTTYNAM
// Analyse /etc/ttys // Analyse /etc/ttys
// -------------------- // --------------------
struct ttyent* ttys_entryt; struct ttyent* ttys_entryt;
@ -2216,6 +2241,7 @@ void FTerm::getSystemTermType()
} }
endttyent(); endttyent();
#endif
} }
// use vt100 if not found // use vt100 if not found
@ -2637,6 +2663,11 @@ void FTerm::init_global_values()
// Teletype (tty) file descriptor is still undefined // Teletype (tty) file descriptor is still undefined
fd_tty = -1; fd_tty = -1;
// Gnome terminal id from SecDA
// Example: vte version 0.40.0 = 0 * 100 + 40 * 100 + 0 = 4000
// a.b.c = a * 100 + b * 100 + c
gnome_terminal_id = 0;
// Preset to false // Preset to false
utf8_console = \ utf8_console = \
utf8_input = \ utf8_input = \
@ -2653,6 +2684,7 @@ void FTerm::init_global_values()
decscusr_support = \ decscusr_support = \
force_vt100 = \ force_vt100 = \
tera_terminal = \ tera_terminal = \
sun_terminal = \
kterm_terminal = \ kterm_terminal = \
gnome_terminal = \ gnome_terminal = \
kde_konsole = \ kde_konsole = \
@ -2677,6 +2709,9 @@ void FTerm::init_global_values()
// init arrays with '\0' // init arrays with '\0'
std::fill_n (exit_message, sizeof(exit_message), '\0'); std::fill_n (exit_message, sizeof(exit_message), '\0');
if ( ! init_values.terminal_detection )
terminal_detection = false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2772,6 +2807,13 @@ void FTerm::termtypeAnalysis()
ansi_terminal = true; ansi_terminal = true;
} }
// Sun Microsystems workstation console
if ( std::strncmp(termtype, "sun", 3) == 0 )
{
terminal_detection = false;
sun_terminal = true;
}
// Linux console // Linux console
if ( std::strncmp(termtype, const_cast<char*>("linux"), 5) == 0 if ( std::strncmp(termtype, const_cast<char*>("linux"), 5) == 0
|| std::strncmp(termtype, const_cast<char*>("con"), 3) == 0 ) || std::strncmp(termtype, const_cast<char*>("con"), 3) == 0 )
@ -3047,9 +3089,10 @@ char* FTerm::parseSecDA (char*& current_termtype)
// Each gnome-terminal should be able to use 256 colors // Each gnome-terminal should be able to use 256 colors
color256 = true; color256 = true;
new_termtype = const_cast<char*>("gnome-256color"); new_termtype = const_cast<char*>("gnome-256color");
gnome_terminal_id = terminal_id_version;
// VTE 0.40.0 or higher and gnome-terminal 3.16 or higher // VTE 0.40.0 or higher and gnome-terminal 3.16 or higher
if ( terminal_id_version >= 4000 ) if ( gnome_terminal_id >= 4000 )
decscusr_support = true; decscusr_support = true;
} }
break; break;
@ -3474,6 +3517,10 @@ void FTerm::init_termcaps_quirks()
{ {
init_termcaps_teraterm_quirks(); init_termcaps_teraterm_quirks();
} }
else if ( sun_terminal )
{
init_termcaps_sun_quirks();
}
else if ( putty_terminal ) else if ( putty_terminal )
{ {
init_termcaps_putty_quirks(); init_termcaps_putty_quirks();
@ -3753,6 +3800,13 @@ void FTerm::init_termcaps_teraterm_quirks()
const_cast<char*>(CSI "39;49m"); const_cast<char*>(CSI "39;49m");
} }
//----------------------------------------------------------------------
void FTerm::init_termcaps_sun_quirks()
{
// Sun Microsystems workstation console eat_nl_glitch fix
FTermcap::eat_nl_glitch = true;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::init_termcaps_screen_quirks() void FTerm::init_termcaps_screen_quirks()
{ {
@ -4056,6 +4110,11 @@ void FTerm::init_locale()
if ( tera_terminal && ! std::strcmp(nl_langinfo(CODESET), "UTF-8") ) if ( tera_terminal && ! std::strcmp(nl_langinfo(CODESET), "UTF-8") )
locale_name = std::setlocale (LC_ALL, "C"); locale_name = std::setlocale (LC_ALL, "C");
// Sun (color) workstation console can't show UTF-8 character
if ( std::strncmp(termtype, "sun", 3) == 0
&& ! std::strcmp(nl_langinfo(CODESET), "UTF-8") )
locale_name = std::setlocale (LC_ALL, "C");
// Try to found a meaningful content for locale_name // Try to found a meaningful content for locale_name
if ( locale_name ) if ( locale_name )
locale_name = std::setlocale (LC_CTYPE, 0); locale_name = std::setlocale (LC_CTYPE, 0);
@ -4157,67 +4216,71 @@ void FTerm::init_encoding()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::redefineColorPalette() void FTerm::redefineColorPalette()
{ {
if ( ! cygwin_terminal if ( cygwin_terminal
&& ! kde_konsole || kde_konsole
&& ! tera_terminal || tera_terminal
&& ! ansi_terminal ) || sun_terminal
{ || ansi_terminal )
resetColorMap(); return;
saveColorMap();
if ( FTermcap::max_color >= 16 ) resetColorMap();
{ saveColorMap();
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x22, 0x22, 0xb2); if ( FTermcap::max_color >= 16 )
setPalette (fc::Green, 0x18, 0x78, 0x18); {
setPalette (fc::Cyan, 0x4a, 0x4a, 0xe4); setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Red, 0xb2, 0x18, 0x18); setPalette (fc::Blue, 0x22, 0x22, 0xb2);
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2); setPalette (fc::Green, 0x18, 0x78, 0x18);
setPalette (fc::Brown, 0xe8, 0x87, 0x1f); setPalette (fc::Cyan, 0x4a, 0x4a, 0xe4);
setPalette (fc::LightGray, 0xbc, 0xbc, 0xbc); setPalette (fc::Red, 0xb2, 0x18, 0x18);
setPalette (fc::DarkGray, 0x50, 0x50, 0x50); setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
setPalette (fc::LightBlue, 0x80, 0xa4, 0xec); setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
setPalette (fc::LightGreen, 0x5e, 0xeb, 0x5c); setPalette (fc::LightGray, 0xbc, 0xbc, 0xbc);
setPalette (fc::LightCyan, 0x62, 0xbf, 0xf8); setPalette (fc::DarkGray, 0x50, 0x50, 0x50);
setPalette (fc::LightRed, 0xed, 0x57, 0x31); setPalette (fc::LightBlue, 0x80, 0xa4, 0xec);
setPalette (fc::LightMagenta, 0xe9, 0xad, 0xff); setPalette (fc::LightGreen, 0x5e, 0xeb, 0x5c);
setPalette (fc::Yellow, 0xfb, 0xe8, 0x67); setPalette (fc::LightCyan, 0x62, 0xbf, 0xf8);
setPalette (fc::White, 0xff, 0xff, 0xff); setPalette (fc::LightRed, 0xed, 0x57, 0x31);
} setPalette (fc::LightMagenta, 0xe9, 0xad, 0xff);
else // 8 colors setPalette (fc::Yellow, 0xfb, 0xe8, 0x67);
{ setPalette (fc::White, 0xff, 0xff, 0xff);
setPalette (fc::Black, 0x00, 0x00, 0x00); }
setPalette (fc::Blue, 0x22, 0x22, 0xb2); else // 8 colors
setPalette (fc::Green, 0x18, 0x78, 0x18); {
setPalette (fc::Cyan, 0x66, 0x66, 0xff); setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Red, 0xb2, 0x18, 0x18); setPalette (fc::Blue, 0x22, 0x22, 0xb2);
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2); setPalette (fc::Green, 0x18, 0x78, 0x18);
setPalette (fc::Brown, 0xe8, 0x87, 0x1f); setPalette (fc::Cyan, 0x66, 0x66, 0xff);
setPalette (fc::LightGray, 0xd0, 0xd0, 0xd0); setPalette (fc::Red, 0xb2, 0x18, 0x18);
} setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
setPalette (fc::LightGray, 0xe0, 0xe0, 0xe0);
} }
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::restoreColorPalette() void FTerm::restoreColorPalette()
{ {
if ( ! (kde_konsole || tera_terminal || ansi_terminal) ) if ( kde_konsole
{ || tera_terminal
// Reset screen settings || sun_terminal
if ( FTermcap::max_color >= 16 ) || ansi_terminal )
{ return;
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
setPalette (fc::LightGray, 0xb2, 0xb2, 0xb2);
setPalette (fc::DarkGray, 0x68, 0x68, 0x68);
setPalette (fc::LightBlue, 0x54, 0x54, 0xff);
setPalette (fc::LightGreen, 0x54, 0xff, 0x54);
}
else // 8 colors
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
resetXTermColors(); // Reset screen settings
resetColorMap(); if ( FTermcap::max_color >= 16 )
{
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
setPalette (fc::LightGray, 0xb2, 0xb2, 0xb2);
setPalette (fc::DarkGray, 0x68, 0x68, 0x68);
setPalette (fc::LightBlue, 0x54, 0x54, 0xff);
setPalette (fc::LightGreen, 0x54, 0xff, 0x54);
} }
else // 8 colors
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
resetXTermColors();
resetColorMap();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -4291,9 +4354,6 @@ void FTerm::init()
// Initialize global values for all objects // Initialize global values for all objects
init_global_values(); init_global_values();
if ( ! init_values.terminal_detection )
terminal_detection = false;
// Get file descriptor for standard input and standard output // Get file descriptor for standard input and standard output
stdin_no = fileno(stdin); stdin_no = fileno(stdin);
stdout_no = fileno(stdout); stdout_no = fileno(stdout);
@ -4363,32 +4423,35 @@ void FTerm::init()
// Enable the terminal mouse support // Enable the terminal mouse support
enableMouse(); enableMouse();
// activate meta key sends escape // Activate meta key sends escape
if ( xterm_terminal ) if ( xterm_terminal )
xtermMetaSendsESC(true); xtermMetaSendsESC(true);
// enter 'keyboard_transmit' mode // Enter 'keyboard_transmit' mode
if ( TCAP(fc::t_keypad_xmit) ) if ( TCAP(fc::t_keypad_xmit) )
{ {
putstring (TCAP(fc::t_keypad_xmit)); putstring (TCAP(fc::t_keypad_xmit));
std::fflush(stdout); std::fflush(stdout);
} }
// save current cursor position if ( use_alternate_screen )
if ( use_alternate_screen && TCAP(fc::t_save_cursor) )
{ {
putstring (TCAP(fc::t_save_cursor)); // Save current cursor position
std::fflush(stdout); if ( TCAP(fc::t_save_cursor) )
{
putstring (TCAP(fc::t_save_cursor));
std::fflush(stdout);
}
// Saves the screen and the cursor position
if ( TCAP(fc::t_enter_ca_mode) )
{
putstring (TCAP(fc::t_enter_ca_mode));
std::fflush(stdout);
}
} }
// saves the screen and the cursor position // Enable alternate charset
if ( use_alternate_screen && TCAP(fc::t_enter_ca_mode) )
{
putstring (TCAP(fc::t_enter_ca_mode));
std::fflush(stdout);
}
// enable alternate charset
if ( TCAP(fc::t_enable_acs) ) if ( TCAP(fc::t_enable_acs) )
{ {
putstring (TCAP(fc::t_enable_acs)); putstring (TCAP(fc::t_enable_acs));
@ -4424,10 +4487,10 @@ void FTerm::init()
// (depending on the initialization values) // (depending on the initialization values)
init_font(); init_font();
// turn off hardware echo // Turn off hardware echo
noHardwareEcho(); noHardwareEcho();
// switch to the raw mode // Switch to the raw mode
setRawMode(); setRawMode();
// The terminal is now initialized // The terminal is now initialized
@ -4508,18 +4571,21 @@ void FTerm::finish()
if ( xterm_terminal ) if ( xterm_terminal )
xtermMetaSendsESC(false); xtermMetaSendsESC(false);
// restores the screen and the cursor position if ( use_alternate_screen )
if ( use_alternate_screen && TCAP(fc::t_exit_ca_mode) )
{ {
putstring (TCAP(fc::t_exit_ca_mode)); // restores the screen and the cursor position
std::fflush(stdout); if ( TCAP(fc::t_exit_ca_mode) )
} {
putstring (TCAP(fc::t_exit_ca_mode));
std::fflush(stdout);
}
// restore cursor to position of last save_cursor // restore cursor to position of last save_cursor
if ( use_alternate_screen && TCAP(fc::t_restore_cursor) ) if ( TCAP(fc::t_restore_cursor) )
{ {
putstring (TCAP(fc::t_restore_cursor)); putstring (TCAP(fc::t_restore_cursor));
std::fflush(stdout); std::fflush(stdout);
}
} }
// leave 'keyboard_transmit' mode // leave 'keyboard_transmit' mode

View File

@ -2380,7 +2380,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
{ {
uInt leading_whitespace = 1; uInt leading_whitespace = 1;
bool normal = isNormal(first_char); bool normal = isNormal(first_char);
bool& ut = FTermcap::background_color_erase; bool& ut = FTermcap::background_color_erase;
for (uInt x = 1; x < uInt(vt->width); x++) for (uInt x = 1; x < uInt(vt->width); x++)
{ {
@ -2411,7 +2411,6 @@ bool FVTerm::canClearTailingWS (uInt& xmax, uInt y)
// => clear from xmax to end of line // => clear from xmax to end of line
term_area*& vt = vterm; term_area*& vt = vterm;
bool& ut = FTermcap::background_color_erase;
char*& ce = TCAP(fc::t_clr_eol); char*& ce = TCAP(fc::t_clr_eol);
char_data* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1]; char_data* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
@ -2419,6 +2418,7 @@ bool FVTerm::canClearTailingWS (uInt& xmax, uInt y)
{ {
uInt tailing_whitespace = 1; uInt tailing_whitespace = 1;
bool normal = isNormal(last_char); bool normal = isNormal(last_char);
bool& ut = FTermcap::background_color_erase;
for (uInt x = uInt(vt->width) - 1; x > 0 ; x--) for (uInt x = uInt(vt->width) - 1; x > 0 ; x--)
{ {