Commit 93434017 authored by Nalin Dahyabhai's avatar Nalin Dahyabhai

add a --with-default-emulation argument (part of #115750). Use

* configure.in: add a --with-default-emulation argument (part of #115750).  Use
	AS_HELP_STRING wherever we need help strings.
* vte.pc.in, vte-uninstalled.pc.in: add DefaultEmulation variable
* vte.spec: specify "xterm" as the default-emulation, even though it's the
	default default
* termcaps/Makefile.am: build and install the default emulation's
	termcap, assuming it's some kind of xterm variant.
* src/keymap.c(_vte_keymap_map): check for xterm-xfree86 definitions
	if the terminal type includes xterm, not if it exactly matches xterm
* src/reaper.c(vte_reaper_add_child): add.  The glib 2.4 SIGCHLD watcher
	requires us to register particular PIDs for monitoring, so now we
	require applications to do so.
* src/reaper.c(vte_reaper_child_watch_cb): add.
* src/reaper.c(vte_reaper_init): Don't hook the SIGCHLD handler if we're
	running under glib 2.4, expect to use the g_child_watch mechanism.
* src/vte.c: remove hard-coded definition of VTE_DEFAULT_EMULATION, to be
	picked up from config.h instead.
* src/vte.c(vte_sequence_handler_cs): remove stray debug printfs.
* src/vte.c(vte_terminal_insert_char): only do what we were doing for xn if LP
	was also set (#141445).
* src/vte.c(vte_terminal_get_default_emulation): add.
* src/vte.c(_vte_terminal_fork_basic): call vte_reaper_add_child for new
	children.
parent bcee3ff9
2004-04-29 nalin
* configure.in: add a --with-default-emulation argument (part of
#115750). Use AS_HELP_STRING wherever we need help strings.
* vte.pc.in, vte-uninstalled.pc.in: add DefaultEmulation variable
* vte.spec: specify "xterm" as the default-emulation, even though it's
the default default
* termcaps/Makefile.am: build and install the default emulation's
termcap, assuming it's some kind of xterm variant.
* src/keymap.c(_vte_keymap_map): check for xterm-xfree86 definitions
if the terminal type includes xterm, not if it exactly matches xterm
* src/reaper.c(vte_reaper_add_child): add. The glib 2.4 SIGCHLD
watcher requires us to register particular PIDs for monitoring, so now
we require applications to do so.
* src/reaper.c(vte_reaper_child_watch_cb): add.
* src/reaper.c(vte_reaper_init): Don't hook the SIGCHLD handler if
we're running under glib 2.4, expect to use the g_child_watch
mechanism.
* src/vte.c: remove hard-coded definition of VTE_DEFAULT_EMULATION,
to be picked up from config.h instead.
* src/vte.c(vte_sequence_handler_cs): remove stray debug printfs.
* src/vte.c(vte_terminal_insert_char): only do what we were doing for
xn if LP was also set (#141445).
* src/vte.c(vte_terminal_get_default_emulation): add.
* src/vte.c(_vte_terminal_fork_basic): call vte_reaper_add_child for
new children.
2004-04-27 nalin
* src/vte.c(vte_terminal_fork_command): more clearly document what
the argv and envv arguments are expected to contain (#127979).
......
......@@ -44,9 +44,17 @@ PKG_CHECK_MODULES(GTK,[glib-2.0 gobject-2.0 $MODULEGTK])
wantedmodules="glib-2.0 gobject-2.0 $MODULEGTK fontconfig"
# Let the user specify the default terminal emulation.
AC_ARG_WITH(default-emulation,
AS_HELP_STRING(--with-default-emulation=xterm,default terminal type to be emulated),
emulation=$withval,emulation=xterm)
AC_DEFINE_UNQUOTED(VTE_DEFAULT_EMULATION,"$emulation",[The default terminal type to be emulated.])
VTE_DEFAULT_EMULATION=$emulation
AC_SUBST(VTE_DEFAULT_EMULATION)
# Use Xft2 if Pango has Xft2 support and it isn't disabled.
if test "$have_x" = yes ; then
AC_ARG_WITH(xft2,[ --with-xft2 enable drawing using Xft2],with_xft2=$withval,with_xft2=yes)
AC_ARG_WITH(xft2,[AS_HELP_STRING(--with-xft2,enable drawing using Xft2)],with_xft2=$withval,with_xft2=yes)
if test $with_xft2 = yes ; then
if pkg-config --exists pangoxft '>=' 1.1.0 ; then
AC_DEFINE(HAVE_XFT2,1,[Whether we have Xft2])
......@@ -60,7 +68,7 @@ fi
# Use PangoX if we have it and it isn't disabled.
if test "$have_x" = yes ; then
AC_ARG_WITH(pangox,[ --with-pangox enable drawing using PangoX],with_pangox=$withval,with_pangox=yes)
AC_ARG_WITH(pangox,[AS_HELP_STRING(--with-pangox,enable drawing using PangoX)],with_pangox=$withval,with_pangox=yes)
if test $with_pangox = yes ; then
if pkg-config --exists pangox ; then
AC_DEFINE(HAVE_PANGOX,1,[Whether we have PangoX])
......@@ -73,7 +81,7 @@ fi
# Use glX if we have it and it isn't disabled.
if test "$have_x" = yes ; then
AC_ARG_WITH(glX,[ --with-glX enable drawing using glX],with_glx=$withval,with_glx=no)
AC_ARG_WITH(glX,[AS_HELP_STRING(--with-glX,enable drawing using glX)],with_glx=$withval,with_glx=no)
if test $with_glx = yes ; then
have_gl=0
have_libgl=0
......@@ -212,7 +220,7 @@ AC_DEFINE(_XOPEN_SOURCE_EXTENDED,1,[Needed to get declarations for msg_control a
AC_DEFINE(_XOPEN_SOURCE,1,[Needed to get declarations for msg_control and msg_controllen on Solaris])
AC_DEFINE(__EXTENSIONS__,1,[Needed to get declarations for msg_control and msg_controllen on Solaris])
AC_ARG_ENABLE(deprecation,[AC_HELP_STRING(--enable-deprecation,prohibit VTE from using deprecated GLib/Pango/GDK/GTK+ features)],usedeprecation=$enableval,usedeprecation=no)
AC_ARG_ENABLE(deprecation,[AS_HELP_STRING(--enable-deprecation,prohibit VTE from using deprecated GLib/Pango/GDK/GTK+ features)],usedeprecation=$enableval,usedeprecation=no)
if test "$usedeprecation" = yes ; then
AC_DEFINE(G_DISABLE_DEPRECATED,1,[Disable deprecated GLib features.])
AC_DEFINE(GDK_DISABLE_DEPRECATED,1,[Disable deprecated GDK features.])
......@@ -262,7 +270,7 @@ OTHERLIBS="$LIBS"
AC_SUBST(OTHERLIBS)
# Enable debugging messages and additional run-time checks.
AC_ARG_ENABLE(debugging,[ --enable-debugging enable extra debugging checks and logging messages],DEBUG=$enableval,DEBUG=no)
AC_ARG_ENABLE(debugging,[AS_HELP_STRING(--enable-debugging,enable extra debugging checks and logging messages)],DEBUG=$enableval,DEBUG=no)
if test x$DEBUG != x ; then
if test x$DEBUG != xno ; then
if test x$GCC = xyes ; then
......@@ -308,7 +316,7 @@ AC_CHECK_TYPES(wint_t, AC_DEFINE(HAVE_WINT_T, , [Defined when the wint_t type is
# Search for Python.
BUILD_PYTHON=true
AC_ARG_ENABLE(python, [ --enable-python Build python bindings [default=yes]],[
AC_ARG_ENABLE(python, [AS_HELP_STRING(--enable-python,Build python bindings [default=yes])],[
if test x"$enableval" != xno ; then
BUILD_PYTHON=true
else
......@@ -403,7 +411,7 @@ AC_DEFINE_UNQUOTED(LOCALEDIR,"$mydatadir/locale",
GETTEXT_PACKAGE=vte
AC_SUBST(GETTEXT_PACKAGE)
AC_ARG_ENABLE(gnome-pty-helper, [ --enable-gnome-pty-helper Build a setuid helper for opening ptys [default=yes]], enable_gnome_pty_helper="$enableval", enable_gnome_pty_helper=yes)
AC_ARG_ENABLE(gnome-pty-helper, [AS_HELP_STRING(--enable-gnome-pty-helper,Build a setuid helper for opening ptys [default=yes])], enable_gnome_pty_helper="$enableval", enable_gnome_pty_helper=yes)
if test "$enable_gnome_pty_helper" != no; then
AC_DEFINE(VTE_USE_GNOME_PTY_HELPER,1,[Define if you intend to use gnome-pty-helper.])
AC_CONFIG_SUBDIRS(gnome-pty-helper)
......@@ -419,7 +427,7 @@ AM_CONDITIONAL(BUILD_GNOME_PTY_HELPER,[test "$enable_gnome_pty_helper" != no])
# Check for gtk-doc.
##################################################
AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
AC_ARG_WITH(html-dir, [AS_HELP_STRING(--with-html-dir=PATH,path to installed docs)])
if test "x$with_html_dir" = "x" ; then
HTML_DIR='${datadir}/gtk-doc/html'
......@@ -455,7 +463,7 @@ if $GTKDOC ; then
fi
dnl Let people disable the gtk-doc stuff.
AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
AC_ARG_ENABLE(gtk-doc, [AS_HELP_STRING(--enable-gtk-doc,Use gtk-doc to build documentation [default=auto])], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
if test x$enable_gtk_doc = xauto ; then
if test x$GTKDOC = xtrue ; then
......
......@@ -1149,7 +1149,7 @@ _vte_keymap_map(guint keyval,
tmp = g_strdup(termcap_special);
cap = tgetstr(tmp, &cap);
}
if ((cap == NULL) && (strcmp(terminal, "xterm") == 0)) {
if ((cap == NULL) && (strstr(terminal, "xterm") == 0)) {
/* try, try again */
if (tgetent(ncurses_buffer, "xterm-xfree86") == 1) {
cap = ncurses_area;
......
......@@ -21,6 +21,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
......@@ -92,6 +93,32 @@ vte_reaper_emit_signal(GIOChannel *channel, GIOCondition condition,
return TRUE;
}
#if GLIB_CHECK_VERSION(2,4,0)
static void
vte_reaper_child_watch_cb(GPid pid, gint status, gpointer data)
{
g_signal_emit_by_name(data, "child-exited", pid, status);
}
#endif
/**
* vte_reaper_add_child:
* @pid: the ID of a child process which will be monitored
* @data: callback data
*
* Ensures that child-exited signals will be emitted when @pid exits. This is
* necessary for correct operation when running with glib versions >= 2.4.
*
* Since 0.11.11
*/
void
vte_reaper_add_child(GPid pid, gpointer data)
{
#if GLIB_CHECK_VERSION(2,4,0)
g_child_watch_add(pid, vte_reaper_child_watch_cb, data);
#endif
}
static void
vte_reaper_channel_destroyed(gpointer data)
{
......@@ -113,6 +140,13 @@ vte_reaper_init(VteReaper *reaper, gpointer *klass)
/* Create the channel. */
reaper->channel = g_io_channel_unix_new(reaper->iopipe[0]);
#if GLIB_CHECK_VERSION(2,4,0)
if ((glib_major_version > 2) || /* 3.x and later */
((glib_major_version == 2) && (glib_minor_version >= 4))) {/* 2.4 */
return;
}
#endif
/* Add the channel to the source list. */
g_io_add_watch_full(reaper->channel,
G_PRIORITY_HIGH,
......@@ -126,6 +160,9 @@ vte_reaper_init(VteReaper *reaper, gpointer *klass)
sigemptyset(&action.sa_mask);
action.sa_flags = SA_RESTART | SA_NOCLDSTOP;
sigaction(SIGCHLD, &action, NULL);
if (_vte_debug_on(VTE_DEBUG_SIGNALS)) {
fprintf(stderr, "Hooked SIGCHLD signal in reaper.\n");
}
}
static void
......@@ -142,6 +179,9 @@ vte_reaper_finalize(GObject *reaper)
if (old_action.sa_handler == vte_reaper_signal_handler) {
sigaction(SIGCHLD, &action, NULL);
}
if (_vte_debug_on(VTE_DEBUG_SIGNALS)) {
fprintf(stderr, "Unhooked SIGCHLD signal in reaper.\n");
}
/* Remove the channel from the source list. */
g_source_remove_by_user_data(reaper);
......
......@@ -58,6 +58,7 @@ GType vte_reaper_get_type(void);
VteReaperClass))
VteReaper *vte_reaper_get(void);
void vte_reaper_add_child(GPid pid, gpointer data);
G_END_DECLS
......
......@@ -96,7 +96,6 @@ typedef gunichar wint_t;
#define VTE_CUR_BG 29
#define VTE_SATURATION_MAX 10000
#define VTE_SCROLLBACK_MIN 100
#define VTE_DEFAULT_EMULATION "xterm"
#define VTE_DEFAULT_CURSOR GDK_XTERM
#define VTE_MOUSING_CURSOR GDK_LEFT_PTR
#define VTE_TAB_MAX 999
......@@ -2598,7 +2597,6 @@ vte_sequence_handler_cs(VteTerminal *terminal,
/* We require two parameters. Anything less is a reset. */
screen = terminal->pvt->screen;
if ((params == NULL) || (params->n_values < 2)) {
fprintf(stderr, "cs()\n");
screen->scrolling_restricted = FALSE;
return FALSE;
}
......@@ -2607,7 +2605,6 @@ vte_sequence_handler_cs(VteTerminal *terminal,
start = g_value_get_long(value);
value = g_value_array_get_nth(params, 1);
end = g_value_get_long(value);
fprintf(stderr, "cs(%d,%d)\n", start, end);
/* Catch garbage. */
rows = terminal->row_count;
if ((start <= 0) || (start >= rows)) {
......@@ -6718,6 +6715,7 @@ vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
if (col + columns > terminal->column_count) {
if (terminal->pvt->flags.am &&
terminal->pvt->flags.xn &&
terminal->pvt->flags.LP &&
g_unichar_isgraph(c)) {
/* Mark this line as soft-wrapped. */
row = _vte_ring_index(screen->row_data,
......@@ -6827,7 +6825,8 @@ vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
/* If we're autowrapping *here* (am but not xn), do it. */
col = screen->cursor_current.col;
if (col >= terminal->column_count) {
if (terminal->pvt->flags.am && !terminal->pvt->flags.xn) {
if (terminal->pvt->flags.am &&
!(terminal->pvt->flags.xn && terminal->pvt->flags.LP)) {
/* Mark this line as soft-wrapped. */
row = _vte_ring_index(screen->row_data,
VteRowData *,
......@@ -7138,6 +7137,7 @@ _vte_terminal_fork_basic(VteTerminal *terminal, const char *command,
/* Catch a child-exited signal from the child pid. */
reaper = vte_reaper_get();
vte_reaper_add_child((GPid) pid, terminal);
g_object_ref(G_OBJECT(reaper));
if (VTE_IS_REAPER(terminal->pvt->pty_reaper)) {
g_signal_handlers_disconnect_by_func(terminal->pvt->pty_reaper,
......@@ -8506,7 +8506,7 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
terminal->pvt->keypad_mode == VTE_KEYMODE_APPLICATION,
terminal->pvt->termcap,
terminal->pvt->emulation ?
terminal->pvt->emulation : "xterm",
terminal->pvt->emulation : vte_terminal_get_default_emulation(terminal),
&normal,
&normal_length,
&special);
......@@ -10826,7 +10826,7 @@ vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation)
/* Set the emulation type, for reference. */
if (emulation == NULL) {
emulation = VTE_DEFAULT_EMULATION;
emulation = vte_terminal_get_default_emulation(terminal);
}
quark = g_quark_from_string(emulation);
terminal->pvt->emulation = g_quark_to_string(quark);
......@@ -10952,6 +10952,23 @@ vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation)
vte_terminal_emit_emulation_changed(terminal);
}
/**
* vte_terminal_get_default_emulation:
* @terminal: a #VteTerminal
*
* Queries the terminal for its default emulation, which is attempted if the
* terminal type passed to vte_terminal_set_emulation() is NULL.
*
* Returns: the name of the default terminal type the widget attempts to emulate
*
* Since 0.11.11
*/
const char *
vte_terminal_get_default_emulation(VteTerminal *terminal)
{
return VTE_DEFAULT_EMULATION;
}
/**
* vte_terminal_get_emulation:
* @terminal: a #VteTerminal
......@@ -10981,7 +10998,7 @@ vte_terminal_set_termcap(VteTerminal *terminal, const char *path,
wpath = g_strdup_printf(DATADIR "/" PACKAGE "/termcap/%s",
terminal->pvt->emulation ?
terminal->pvt->emulation :
VTE_DEFAULT_EMULATION);
vte_terminal_get_default_emulation(terminal));
if (stat(wpath, &st) != 0) {
g_free(wpath);
wpath = g_strdup("/etc/termcap");
......
......@@ -372,6 +372,7 @@ char *vte_terminal_match_check(VteTerminal *terminal,
/* Set the emulation type. Most of the time you won't need this. */
void vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation);
const char *vte_terminal_get_emulation(VteTerminal *terminal);
const char *vte_terminal_get_default_emulation(VteTerminal *terminal);
/* Set the character encoding. Most of the time you won't need this. */
void vte_terminal_set_encoding(VteTerminal *terminal, const char *codeset);
......
EXTRA_DIST = xterm xterm.baseline
termcapdir = $(pkgdatadir)/termcap
termcap_DATA = xterm
termcap_DATA = xterm @VTE_DEFAULT_EMULATION@
@VTE_DEFAULT_EMULATION@: xterm
sed -e s,^xterm:,@VTE_DEFAULT_EMULATION@:,g \
-e s,^xterm\|,@VTE_DEFAULT_EMULATION@\|,g $< > $@
......@@ -9,3 +9,4 @@ Version: @VERSION@
Requires: @NEEDEDPACKAGES@
Libs: ${pc_top_builddir}/${pcfiledir}/src/libvte.la @FT2_LIBS@ @OTHERLIBS@
Cflags: -I${pc_top_builddir}/${pcfiledir}/src @FT2_CFLAGS@ @OTHERCFLAGS@
DefaultEmulation: @VTE_DEFAULT_EMULATION@
......@@ -9,3 +9,4 @@ Version: @VERSION@
Requires: @NEEDEDPACKAGES@
Libs: -L${libdir} -lvte @FT2_LIBS@ @OTHERLIBS@
Cflags: -I${includedir} @FT2_CFLAGS@ @OTHERCFLAGS@
DefaultEmulation: @VTE_DEFAULT_EMULATION@
......@@ -28,7 +28,7 @@ package contains the files needed for building applications using VTE.
if [ -x %{_bindir}/python2.2 ]; then
PYTHON=%{_bindir}/python2.2; export PYTHON
fi
%configure --enable-shared --enable-static --libexecdir=%{_libdir}/%{name} --without-glX
%configure --enable-shared --enable-static --libexecdir=%{_libdir}/%{name} --without-glX --with-default-emulation=xterm
make
%clean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment