Enable xterm "metaSendsEscape" switch

This commit is contained in:
Markus Gans 2017-04-11 00:30:27 +02:00
parent c6dba0b4ac
commit 2ec425480a
7 changed files with 76 additions and 41 deletions

View File

@ -1,3 +1,6 @@
2017-04-11 Markus Gans <guru.mail@muenster.de>
* Enable xterm "metaSendsEscape" switch
2017-04-09 Markus Gans <guru.mail@muenster.de>
* The Final Cut compiles now also under NetBSD
* Rename preprocessor macro names with leading underscore

1
configure vendored
View File

@ -18877,7 +18877,6 @@ $as_echo X"$ac_prefix_conf_OUT" |
rm -f "$ac_prefix_conf_OUT"
mv $tmp/pconfig.h "$ac_prefix_conf_OUT"
fi
cp conftest.prefix _configs.sed
else
as_fn_error $? "input file $ac_prefix_conf_INP does not exist - skip generating $ac_prefix_conf_OUT" "$LINENO" 5
fi

View File

@ -8,18 +8,14 @@
#
# DESCRIPTION
#
# This is a new variant from ac_prefix_config_ this one will use a
# lowercase-prefix if the config-define was starting with a
# lowercase-char, e.g. "#define const", "#define restrict", or "#define
# off_t", (and this one can live in another directory, e.g.
# testpkg/config.h therefore I decided to move the output-header to be the
# first arg)
# Generate an installable config.h.
#
# takes the usual config.h generated header file; looks for each of the
# generated "#define SOMEDEF" lines, and prefixes the defined name (ie.
# makes it "#define PREFIX_SOMEDEF". The result is written to the output
# config.header file. The PREFIX is converted to uppercase for the
# conversions.
# A package should not normally install its config.h as a system header,
# but if it must, this macro can be used to avoid namespace pollution by
# making a copy of config.h with a prefix added to all the macro names.
#
# Each "#define SOMEDEF" line of the configuration header has the given
# prefix added, in the same case as the first character of the macro name.
#
# Defaults:
#
@ -27,9 +23,7 @@
# PREFIX = $PACKAGE
# ORIG-HEADER, from AM_CONFIG_HEADER(config.h)
#
# Your configure.ac script should contain both macros in this order, and
# unlike the earlier variations of this prefix-macro it is okay to place
# the AX_PREFIX_CONFIG_H call before the AC_OUTPUT invokation.
# Your configure.ac script should contain both macros in this order.
#
# Example:
#
@ -42,9 +36,10 @@
# AC_OUTPUT(Makefile) # creates the "config.h" now
# # and also mylib/_config.h
#
# if the argument to AX_PREFIX_CONFIG_H would have been omitted then the
# default outputfile would have been called simply "testpkg-config.h", but
# even under the name "mylib/_config.h" it contains prefix-defines like
# If the argument to AX_PREFIX_CONFIG_H would have been omitted then the
# default output file would have been called simply "testpkg-config.h",
# but even under the name "mylib/_config.h" it contains prefix-defines
# like
#
# #ifndef TESTPKG_VERSION
# #define TESTPKG_VERSION "0.1.1"
@ -56,11 +51,10 @@
# #define _testpkg_const _const
# #endif
#
# and this "mylib/_config.h" can be installed along with other
# header-files, which is most convenient when creating a shared library
# (that has some headers) where some functionality is dependent on the
# OS-features detected at compile-time. No need to invent some
# "mylib-confdefs.h.in" manually. :-)
# and this "mylib/_config.h" can be installed along with other header
# files, which is most convenient when creating a shared library (that has
# some headers) whose functionality depends on features detected at
# compile-time. No need to invent some "mylib-confdefs.h.in" manually.
#
# Note that some AC_DEFINEs that end up in the config.h file are actually
# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T
@ -89,6 +83,7 @@
#
# LICENSE
#
# Copyright (c) 2014 Reuben Thomas <rrt@sc3d.org>
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2008 Marten Svantesson
# Copyright (c) 2008 Gerald Point <Gerald.Point@labri.fr>
@ -119,12 +114,12 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 11
#serial 15
AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl
AC_PREREQ([2.62])
AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl
AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
AC_CONFIG_COMMANDS(m4_default([$1], [$PACKAGE-config.h]),[dnl
AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
@ -133,12 +128,12 @@ AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
m4_pushdef([_script],[conftest.prefix])dnl
m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
_OUT=`echo m4_default([$1], [$PACKAGE-config.h])`
_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
_PKG=`echo ifelse($2, , $PACKAGE, $2)`
_PKG=`echo m4_default([$2], [$PACKAGE])`
_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
_INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'`
_INP=`echo "$3" | sed -e 's/ *//'`
if test ".$_INP" = "."; then
for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
case "$ac_file" in
@ -192,7 +187,6 @@ else
rm -f "$_OUT"
mv $tmp/pconfig.h "$_OUT"
fi
cp _script _configs.sed
else
AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
fi

View File

@ -717,7 +717,7 @@ int FOptiMove::repeatedAppend (capability& o, int count, char* dst)
dst_len = ( dst != 0 ) ? std::strlen(dst) : 0;
total = 0;
if ( (dst_len + uInt(count) * src_len) < sizeof(move_buf)-1 )
if ( (dst_len + uInt(count) * src_len) < sizeof(move_buf) - 1 )
{
total += count * o.duration;
@ -727,7 +727,7 @@ int FOptiMove::repeatedAppend (capability& o, int count, char* dst)
while ( count-- > 0 )
{
std::strcpy (dst, o.cap);
std::strncpy (dst, o.cap, src_len + 1);
dst += src_len;
}
}
@ -757,7 +757,9 @@ int FOptiMove::relativeMove ( char*& move
if ( F_row_address.cap )
{
if ( move )
std::strcpy (move, tparm(F_row_address.cap, to_y, 0, 0, 0, 0, 0, 0, 0, 0));
std::strncpy ( move
, tparm(F_row_address.cap, to_y, 0, 0, 0, 0, 0, 0, 0, 0)
, sizeof(move_buf) - 1 );
vtime = F_row_address.duration;
}
@ -769,7 +771,9 @@ int FOptiMove::relativeMove ( char*& move
if ( F_parm_down_cursor.cap && F_parm_down_cursor.duration < vtime )
{
if ( move )
std::strcpy (move, tparm(F_parm_down_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0));
std::strncpy ( move
, tparm(F_parm_down_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0)
, sizeof(move_buf) - 1 );
vtime = F_parm_down_cursor.duration;
}
@ -789,7 +793,9 @@ int FOptiMove::relativeMove ( char*& move
if ( F_parm_up_cursor.cap && F_parm_up_cursor.duration < vtime )
{
if ( move )
std::strcpy (move, tparm(F_parm_up_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0));
std::strncpy ( move
, tparm(F_parm_up_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0)
, sizeof(move_buf) - 1 );
vtime = F_parm_up_cursor.duration;
}
@ -865,7 +871,7 @@ int FOptiMove::relativeMove ( char*& move
if ( htime_r < htime )
{
std::strcpy (hmove, str);
std::strncpy (hmove, str, sizeof(move_buf) - 1);
htime = htime_r;
}
@ -915,7 +921,7 @@ int FOptiMove::relativeMove ( char*& move
if ( htime_l < htime )
{
std::strcpy (hmove, str);
std::strncpy (hmove, str, sizeof(move_buf) - 1);
htime = htime_l;
}
@ -928,9 +934,9 @@ int FOptiMove::relativeMove ( char*& move
if ( move )
{
if ( *move )
strcat (move, hmove);
std::strncat (move, hmove, sizeof(move_buf) - std::strlen(move) - 1);
else
std::strcpy (move, hmove);
std::strncpy (move, hmove, sizeof(move_buf) - 1);
}
}

View File

@ -2235,7 +2235,7 @@ inline void FString::_replace (const wchar_t* s)
<< e.what() << std::endl;
return;
}*/
std::wcscpy (string, s);
std::wcsncpy (string, s, bufsize);
}
//----------------------------------------------------------------------
@ -2257,7 +2257,7 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t* s)
return;
}
std::wcscpy (string, s);
std::wcsncpy (string, s, bufsize);
return;
}
else

View File

@ -55,6 +55,7 @@ bool FTerm::cygwin_terminal;
bool FTerm::mintty_terminal;
bool FTerm::linux_terminal;
bool FTerm::netbsd_terminal;
bool FTerm::openbsd_terminal;
bool FTerm::screen_terminal;
bool FTerm::tmux_terminal;
bool FTerm::pc_charset_console;
@ -1747,6 +1748,20 @@ char* FTerm::changeAttribute ( char_data*& term_attr
return opti_attr->changeAttribute (term_attr, next_attr);
}
//----------------------------------------------------------------------
void FTerm::xtermMetaSendsESC (bool on)
{
// activate/deactivate the xterm meta key sends escape prefix
if ( on )
putstring (CSI "?1036s" // save meta key sends escape
CSI "?1036h"); // enable meta key sends escape
else
putstring (CSI "?1036r"); // restore meta key sends escape
std::fflush(stdout);
}
//----------------------------------------------------------------------
void FTerm::xtermMouse (bool on)
{
@ -2637,7 +2652,13 @@ char* FTerm::parseSecDA (char*& current_termtype)
case 24: // DEC VT320
if ( terminal_id_version == 20 )
netbsd_terminal = true; // NetBSD workstation console
{
// NetBSD/OpenBSD workstation console
if ( std::strncmp(termtype, const_cast<char*>("wsvt25"), 6) == 0 )
netbsd_terminal = true;
else if ( std::strncmp(termtype, const_cast<char*>("vt220"), 5) == 0 )
openbsd_terminal = true;
}
break;
case 41: // DEC VT420
@ -3501,6 +3522,7 @@ void FTerm::init()
urxvt_terminal = \
mlterm_terminal = \
mintty_terminal = \
openbsd_terminal = \
screen_terminal = \
tmux_terminal = \
xterm_default_colors = false;
@ -3727,6 +3749,10 @@ void FTerm::init()
enableXTermMouse();
}
// activate meta key sends escape
if ( xterm_terminal )
xtermMetaSendsESC(true);
// enter 'keyboard_transmit' mode
if ( tcap[fc::t_keypad_xmit].string )
{
@ -3900,9 +3926,14 @@ void FTerm::finish()
resetBeep();
// disable xterm mouse support
if ( mouse_support )
disableXTermMouse();
// deactivate meta key sends escape
if ( xterm_terminal )
xtermMetaSendsESC(false);
#ifdef F_HAVE_LIBGPM
if ( gpm_mouse_enabled )

View File

@ -289,6 +289,7 @@ class FTerm
, char_data*& );
static bool hasChangedTermSize();
static void changeTermSizeFinished();
static void xtermMetaSendsESC (bool);
static void xtermMouse (bool);
static void enableXTermMouse();
static void disableXTermMouse();
@ -432,6 +433,7 @@ class FTerm
static bool mintty_terminal;
static bool linux_terminal;
static bool netbsd_terminal;
static bool openbsd_terminal;
static bool screen_terminal;
static bool tmux_terminal;
static char termtype[30];