Renamed MooTermVt to MooTermPt
This commit is contained in:
parent
9e0b5e1110
commit
11ec747563
@ -19,16 +19,16 @@ widget_sources = \
|
||||
mootermparser.h \
|
||||
mootermparser-yacc.y \
|
||||
mootermselection.c \
|
||||
mootermvt.c \
|
||||
mootermvt.h
|
||||
mootermpt.c \
|
||||
mootermpt.h
|
||||
|
||||
widget_unix_sources = \
|
||||
mootermvt-unix.c \
|
||||
mootermpt-unix.c \
|
||||
pty.c \
|
||||
pty.h
|
||||
|
||||
widget_win32_sources = \
|
||||
mootermvt-win32.c
|
||||
mootermpt-win32.c
|
||||
|
||||
AM_INCLUDES =
|
||||
common_cflags = \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* mooterm/mooterm-priavte.h
|
||||
* mooterm/mooterm-private.h
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
#include "mooterm/mooterm.h"
|
||||
#include "mooterm/mootermbuffer-private.h"
|
||||
#include "mooterm/mootermvt.h"
|
||||
#include "mooterm/mootermpt.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -25,8 +25,8 @@ G_BEGIN_DECLS
|
||||
#define ADJUSTMENT_VALUE_PRIORITY G_PRIORITY_DEFAULT_IDLE
|
||||
#define EXPOSE_PRIORITY G_PRIORITY_DEFAULT_IDLE
|
||||
|
||||
#define VT_WRITER_PRIORITY G_PRIORITY_DEFAULT_IDLE
|
||||
#define VT_READER_PRIORITY G_PRIORITY_HIGH_IDLE
|
||||
#define PT_WRITER_PRIORITY G_PRIORITY_DEFAULT_IDLE
|
||||
#define PT_READER_PRIORITY G_PRIORITY_HIGH_IDLE
|
||||
|
||||
#define MAX_TERMINAL_WIDTH 4096
|
||||
#define DEFAULT_MONOSPACE_FONT "Courier New 9"
|
||||
@ -59,7 +59,7 @@ typedef struct _TermSelection TermSelection;
|
||||
|
||||
struct _MooTermPrivate {
|
||||
MooTermBuffer *buffer;
|
||||
MooTermVt *vt;
|
||||
MooTermPt *pt;
|
||||
|
||||
gboolean scrolled;
|
||||
guint _top_line;
|
||||
@ -266,17 +266,17 @@ inline static gboolean term_selected (TermSelection *sel,
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* MooTermVtPrivate
|
||||
/* MooTermPtPrivate
|
||||
*/
|
||||
|
||||
enum {
|
||||
VT_NONE = 0,
|
||||
VT_READ,
|
||||
VT_WRITE
|
||||
PT_NONE = 0,
|
||||
PT_READ,
|
||||
PT_WRITE
|
||||
};
|
||||
|
||||
|
||||
struct _MooTermVtPrivate {
|
||||
struct _MooTermPtPrivate {
|
||||
MooTermBuffer *buffer;
|
||||
|
||||
GQueue *pending_write; /* list->data is GByteArray* */
|
||||
@ -284,7 +284,7 @@ struct _MooTermVtPrivate {
|
||||
};
|
||||
|
||||
|
||||
inline static void vt_discard (GSList **list)
|
||||
inline static void pt_discard (GSList **list)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
@ -295,18 +295,18 @@ inline static void vt_discard (GSList **list)
|
||||
*list = NULL;
|
||||
}
|
||||
|
||||
inline static void vt_flush_pending_write (MooTermVt *vt)
|
||||
inline static void pt_flush_pending_write (MooTermPt *pt)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = vt->priv->pending_write->head; l != NULL; l = l->next)
|
||||
for (l = pt->priv->pending_write->head; l != NULL; l = l->next)
|
||||
g_byte_array_free (l->data, TRUE);
|
||||
|
||||
while (!g_queue_is_empty (vt->priv->pending_write))
|
||||
g_queue_pop_head (vt->priv->pending_write);
|
||||
while (!g_queue_is_empty (pt->priv->pending_write))
|
||||
g_queue_pop_head (pt->priv->pending_write);
|
||||
}
|
||||
|
||||
inline static void vt_add_data (GSList **list, const char *data, gssize len)
|
||||
inline static void pt_add_data (GSList **list, const char *data, gssize len)
|
||||
{
|
||||
if (data && len && (len > 0 || data[0]))
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ static void moo_term_get_property (GObject *object,
|
||||
static void moo_term_init (MooTerm *term)
|
||||
{
|
||||
term->priv = g_new0 (MooTermPrivate, 1);
|
||||
term->priv->vt = moo_term_vt_new ();
|
||||
term->priv->pt = moo_term_pt_new ();
|
||||
term->priv->selection = term_selection_new ();
|
||||
moo_term_set_buffer (term, NULL);
|
||||
}
|
||||
@ -175,13 +175,6 @@ static void moo_term_finalize (GObject *object)
|
||||
MooTerm *term = MOO_TERM (object);
|
||||
guint i, j;
|
||||
|
||||
g_print ("width: %d\ntotal number of lines: %d\n",
|
||||
term_width (term),
|
||||
buf_total_height (term->priv->buffer));
|
||||
guint line_size = sizeof (MooTermLine) + sizeof (MooTermCell) * term_width (term);
|
||||
g_print ("size of one line: %d\ntotal memory for buffer: %d\n",
|
||||
line_size, buf_total_height (term->priv->buffer) * line_size);
|
||||
|
||||
g_signal_handler_disconnect (term->priv->buffer,
|
||||
term->priv->buf_scrollback_changed_id);
|
||||
g_signal_handler_disconnect (term->priv->buffer,
|
||||
@ -196,7 +189,7 @@ static void moo_term_finalize (GObject *object)
|
||||
term->priv->buf_feed_child_id);
|
||||
g_object_unref (term->priv->buffer);
|
||||
|
||||
g_object_unref (term->priv->vt);
|
||||
g_object_unref (term->priv->pt);
|
||||
term_selection_free (term->priv->selection);
|
||||
|
||||
for (i = 0; i < CURSORS_NUM; ++i)
|
||||
@ -590,7 +583,7 @@ void moo_term_set_buffer (MooTerm *term,
|
||||
term->priv->buffer = moo_term_buffer_new (0, 0);
|
||||
}
|
||||
|
||||
moo_term_vt_set_buffer (term->priv->vt, term->priv->buffer);
|
||||
moo_term_pt_set_buffer (term->priv->pt, term->priv->buffer);
|
||||
|
||||
term->priv->buf_scrollback_changed_id =
|
||||
g_signal_connect_swapped (term->priv->buffer,
|
||||
@ -637,7 +630,7 @@ void moo_term_set_buffer (MooTerm *term,
|
||||
|
||||
term->priv->scrolled = FALSE;
|
||||
moo_term_buffer_set_screen_size (term->priv->buffer, width, height);
|
||||
moo_term_vt_set_size (term->priv->vt, width, height);
|
||||
moo_term_pt_set_size (term->priv->pt, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -665,7 +658,7 @@ void moo_term_size_changed (MooTerm *term)
|
||||
return;
|
||||
|
||||
moo_term_buffer_set_screen_size (term->priv->buffer, width, height);
|
||||
moo_term_vt_set_size (term->priv->vt, width, height);
|
||||
moo_term_pt_set_size (term->priv->pt, width, height);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (term))
|
||||
moo_term_resize_back_pixmap (term);
|
||||
@ -679,7 +672,7 @@ gboolean moo_term_fork_command (MooTerm *term,
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_TERM (term), FALSE);
|
||||
|
||||
return moo_term_vt_fork_command (term->priv->vt,
|
||||
return moo_term_pt_fork_command (term->priv->pt,
|
||||
cmd, working_dir, envp);
|
||||
}
|
||||
|
||||
@ -689,7 +682,7 @@ void moo_term_feed_child (MooTerm *term,
|
||||
int len)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TERM (term));
|
||||
moo_term_vt_write (term->priv->vt, string, len);
|
||||
moo_term_pt_write (term->priv->pt, string, len);
|
||||
}
|
||||
|
||||
|
||||
@ -711,7 +704,7 @@ void moo_term_paste_clipboard (MooTerm *term)
|
||||
|
||||
if (text)
|
||||
{
|
||||
moo_term_vt_write (term->priv->vt, text, -1);
|
||||
moo_term_pt_write (term->priv->pt, text, -1);
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* mooterm/mootermvt-unix.c
|
||||
* mooterm/mootermpt-unix.c
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
@ -41,18 +41,18 @@
|
||||
#define POLL_NUM 1
|
||||
|
||||
|
||||
#define MOO_TERM_VT_UNIX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_TERM_VT_UNIX, MooTermVtUnix))
|
||||
#define MOO_TERM_VT_UNIX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_TERM_VT_UNIX, MooTermVtUnixClass))
|
||||
#define MOO_IS_TERM_VT_UNIX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_TERM_VT_UNIX))
|
||||
#define MOO_IS_TERM_VT_UNIX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_TERM_VT_UNIX))
|
||||
#define MOO_TERM_VT_UNIX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_TERM_VT_UNIX, MooTermVtUnixClass))
|
||||
#define MOO_TERM_PT_UNIX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_TERM_PT_UNIX, MooTermPtUnix))
|
||||
#define MOO_TERM_PT_UNIX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_TERM_PT_UNIX, MooTermPtUnixClass))
|
||||
#define MOO_IS_TERM_PT_UNIX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_TERM_PT_UNIX))
|
||||
#define MOO_IS_TERM_PT_UNIX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_TERM_PT_UNIX))
|
||||
#define MOO_TERM_PT_UNIX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_TERM_PT_UNIX, MooTermPtUnixClass))
|
||||
|
||||
typedef struct _MooTermVtUnix MooTermVtUnix;
|
||||
typedef struct _MooTermVtUnixClass MooTermVtUnixClass;
|
||||
typedef struct _MooTermPtUnix MooTermPtUnix;
|
||||
typedef struct _MooTermPtUnixClass MooTermPtUnixClass;
|
||||
|
||||
|
||||
struct _MooTermVtUnix {
|
||||
MooTermVt parent;
|
||||
struct _MooTermPtUnix {
|
||||
MooTermPt parent;
|
||||
|
||||
gboolean child_alive;
|
||||
GPid child_pid;
|
||||
@ -67,101 +67,101 @@ struct _MooTermVtUnix {
|
||||
};
|
||||
|
||||
|
||||
struct _MooTermVtUnixClass {
|
||||
MooTermVtClass parent_class;
|
||||
struct _MooTermPtUnixClass {
|
||||
MooTermPtClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
static void moo_term_vt_unix_finalize (GObject *object);
|
||||
static void moo_term_pt_unix_finalize (GObject *object);
|
||||
|
||||
static void set_size (MooTermVt *vt,
|
||||
static void set_size (MooTermPt *pt,
|
||||
guint width,
|
||||
guint height);
|
||||
static gboolean fork_command (MooTermVt *vt,
|
||||
static gboolean fork_command (MooTermPt *pt,
|
||||
const char *cmd,
|
||||
const char *working_dir,
|
||||
char **envp);
|
||||
static void vt_write (MooTermVt *vt,
|
||||
static void pt_write (MooTermPt *pt,
|
||||
const char *string,
|
||||
gssize len);
|
||||
static void kill_child (MooTermVt *vt);
|
||||
static void kill_child (MooTermPt *pt);
|
||||
|
||||
static gboolean read_child_out (GIOChannel *source,
|
||||
GIOCondition condition,
|
||||
MooTermVtUnix *vt);
|
||||
static void feed_buffer (MooTermVtUnix *vt,
|
||||
MooTermPtUnix *pt);
|
||||
static void feed_buffer (MooTermPtUnix *pt,
|
||||
const char *string,
|
||||
int len);
|
||||
|
||||
static void start_writer (MooTermVt *vt);
|
||||
static void stop_writer (MooTermVt *vt);
|
||||
static void start_writer (MooTermPt *pt);
|
||||
static void stop_writer (MooTermPt *pt);
|
||||
|
||||
|
||||
/* MOO_TYPE_TERM_VT_UNIX */
|
||||
G_DEFINE_TYPE (MooTermVtUnix, moo_term_vt_unix, MOO_TYPE_TERM_VT)
|
||||
/* MOO_TYPE_TERM_PT_UNIX */
|
||||
G_DEFINE_TYPE (MooTermPtUnix, moo_term_pt_unix, MOO_TYPE_TERM_PT)
|
||||
|
||||
|
||||
static void moo_term_vt_unix_class_init (MooTermVtUnixClass *klass)
|
||||
static void moo_term_pt_unix_class_init (MooTermPtUnixClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
MooTermVtClass *vt_class = MOO_TERM_VT_CLASS (klass);
|
||||
MooTermPtClass *pt_class = MOO_TERM_PT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = moo_term_vt_unix_finalize;
|
||||
gobject_class->finalize = moo_term_pt_unix_finalize;
|
||||
|
||||
vt_class->set_size = set_size;
|
||||
vt_class->fork_command = fork_command;
|
||||
vt_class->write = vt_write;
|
||||
vt_class->kill_child = kill_child;
|
||||
pt_class->set_size = set_size;
|
||||
pt_class->fork_command = fork_command;
|
||||
pt_class->write = pt_write;
|
||||
pt_class->kill_child = kill_child;
|
||||
}
|
||||
|
||||
|
||||
static void moo_term_vt_unix_init (MooTermVtUnix *vt)
|
||||
static void moo_term_pt_unix_init (MooTermPtUnix *pt)
|
||||
{
|
||||
vt->child_alive = FALSE;
|
||||
vt->child_pid = (GPid)-1;
|
||||
pt->child_alive = FALSE;
|
||||
pt->child_pid = (GPid)-1;
|
||||
|
||||
vt->master = -1;
|
||||
vt->width = 80;
|
||||
vt->height = 24;
|
||||
pt->master = -1;
|
||||
pt->width = 80;
|
||||
pt->height = 24;
|
||||
|
||||
vt->non_block = FALSE;
|
||||
vt->io = NULL;
|
||||
vt->io_watch_id = 0;
|
||||
pt->non_block = FALSE;
|
||||
pt->io = NULL;
|
||||
pt->io_watch_id = 0;
|
||||
}
|
||||
|
||||
|
||||
static void moo_term_vt_unix_finalize (GObject *object)
|
||||
static void moo_term_pt_unix_finalize (GObject *object)
|
||||
{
|
||||
MooTermVtUnix *vt = MOO_TERM_VT_UNIX (object);
|
||||
kill_child (MOO_TERM_VT (vt));
|
||||
G_OBJECT_CLASS (moo_term_vt_unix_parent_class)->finalize (object);
|
||||
MooTermPtUnix *pt = MOO_TERM_PT_UNIX (object);
|
||||
kill_child (MOO_TERM_PT (pt));
|
||||
G_OBJECT_CLASS (moo_term_pt_unix_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
static void set_size (MooTermVt *vt,
|
||||
static void set_size (MooTermPt *pt,
|
||||
guint width,
|
||||
guint height)
|
||||
{
|
||||
MooTermVtUnix *vtu;
|
||||
MooTermPtUnix *ptu;
|
||||
|
||||
g_return_if_fail (MOO_IS_TERM_VT_UNIX (vt));
|
||||
g_return_if_fail (MOO_IS_TERM_PT_UNIX (pt));
|
||||
|
||||
vtu = MOO_TERM_VT_UNIX (vt);
|
||||
ptu = MOO_TERM_PT_UNIX (pt);
|
||||
|
||||
if (vtu->child_alive)
|
||||
_vte_pty_set_size (vtu->master, width, height);
|
||||
if (ptu->child_alive)
|
||||
_vte_pty_set_size (ptu->master, width, height);
|
||||
|
||||
vtu->width = width;
|
||||
vtu->height = height;
|
||||
ptu->width = width;
|
||||
ptu->height = height;
|
||||
}
|
||||
|
||||
|
||||
static gboolean fork_command (MooTermVt *vt_gen,
|
||||
static gboolean fork_command (MooTermPt *pt_gen,
|
||||
const char *cmd,
|
||||
const char *working_dir,
|
||||
char **envp)
|
||||
{
|
||||
MooTermVtUnix *vt;
|
||||
MooTermPtUnix *pt;
|
||||
int argv_len;
|
||||
char **argv = NULL;
|
||||
int env_len = 0;
|
||||
@ -172,11 +172,11 @@ static gboolean fork_command (MooTermVt *vt_gen,
|
||||
GSource *src;
|
||||
|
||||
g_return_val_if_fail (cmd != NULL, FALSE);
|
||||
g_return_val_if_fail (MOO_IS_TERM_VT_UNIX (vt_gen), FALSE);
|
||||
g_return_val_if_fail (MOO_IS_TERM_PT_UNIX (pt_gen), FALSE);
|
||||
|
||||
vt = MOO_TERM_VT_UNIX (vt_gen);
|
||||
pt = MOO_TERM_PT_UNIX (pt_gen);
|
||||
|
||||
g_return_val_if_fail (!vt->child_alive, FALSE);
|
||||
g_return_val_if_fail (!pt->child_alive, FALSE);
|
||||
|
||||
if (!g_shell_parse_argv (cmd, &argv_len, &argv, &err))
|
||||
{
|
||||
@ -209,101 +209,101 @@ static gboolean fork_command (MooTermVt *vt_gen,
|
||||
new_env[env_len] = g_strdup ("TERM=" TERM_EMULATION);
|
||||
new_env[env_len + 1] = NULL;
|
||||
|
||||
vt->master = _vte_pty_open (&vt->child_pid, new_env,
|
||||
pt->master = _vte_pty_open (&pt->child_pid, new_env,
|
||||
argv[0],
|
||||
argv,
|
||||
working_dir,
|
||||
vt->width, vt->height,
|
||||
pt->width, pt->height,
|
||||
FALSE, FALSE, FALSE);
|
||||
g_strfreev (new_env);
|
||||
g_strfreev (argv);
|
||||
|
||||
if (vt->master == -1)
|
||||
if (pt->master == -1)
|
||||
{
|
||||
g_critical ("%s: could not fork child", G_STRLOC);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("%s: forked child pid %d", G_STRLOC, vt->child_pid);
|
||||
g_message ("%s: forked child pid %d", G_STRLOC, pt->child_pid);
|
||||
}
|
||||
|
||||
if (waitpid (-1, &status, WNOHANG) == -1)
|
||||
g_critical ("%s: error in waitpid", G_STRLOC);
|
||||
|
||||
if ((flags = fcntl (vt->master, F_GETFL)) < 0)
|
||||
if ((flags = fcntl (pt->master, F_GETFL)) < 0)
|
||||
g_critical ("%s: F_GETFL on master", G_STRLOC);
|
||||
else if (-1 == fcntl (vt->master, F_SETFL, O_NONBLOCK | flags))
|
||||
else if (-1 == fcntl (pt->master, F_SETFL, O_NONBLOCK | flags))
|
||||
g_critical ("%s: F_SETFL on master", G_STRLOC);
|
||||
else
|
||||
vt->non_block = TRUE;
|
||||
pt->non_block = TRUE;
|
||||
|
||||
vt->io = g_io_channel_unix_new (vt->master);
|
||||
g_return_val_if_fail (vt->io != NULL, FALSE);
|
||||
pt->io = g_io_channel_unix_new (pt->master);
|
||||
g_return_val_if_fail (pt->io != NULL, FALSE);
|
||||
|
||||
g_io_channel_set_encoding (vt->io, NULL, NULL);
|
||||
g_io_channel_set_buffered (vt->io, FALSE);
|
||||
g_io_channel_set_encoding (pt->io, NULL, NULL);
|
||||
g_io_channel_set_buffered (pt->io, FALSE);
|
||||
|
||||
vt->io_watch_id = g_io_add_watch (vt->io,
|
||||
pt->io_watch_id = g_io_add_watch (pt->io,
|
||||
G_IO_IN | G_IO_PRI | G_IO_HUP,
|
||||
(GIOFunc) read_child_out,
|
||||
vt);
|
||||
pt);
|
||||
|
||||
src = g_main_context_find_source_by_id (NULL, vt->io_watch_id);
|
||||
src = g_main_context_find_source_by_id (NULL, pt->io_watch_id);
|
||||
|
||||
if (src)
|
||||
g_source_set_priority (src, VT_READER_PRIORITY);
|
||||
g_source_set_priority (src, PT_READER_PRIORITY);
|
||||
else
|
||||
g_warning ("%s: could not find io_watch_id source", G_STRLOC);
|
||||
|
||||
vt->child_alive = TRUE;
|
||||
pt->child_alive = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void kill_child (MooTermVt *vt_gen)
|
||||
static void kill_child (MooTermPt *pt_gen)
|
||||
{
|
||||
MooTermVtUnix *vt = MOO_TERM_VT_UNIX (vt_gen);
|
||||
MooTermPtUnix *pt = MOO_TERM_PT_UNIX (pt_gen);
|
||||
|
||||
if (vt->io_watch_id)
|
||||
if (pt->io_watch_id)
|
||||
{
|
||||
g_source_remove (vt->io_watch_id);
|
||||
vt->io_watch_id = 0;
|
||||
g_source_remove (pt->io_watch_id);
|
||||
pt->io_watch_id = 0;
|
||||
}
|
||||
|
||||
if (vt->io)
|
||||
if (pt->io)
|
||||
{
|
||||
vt_write (MOO_TERM_VT (vt), "\4", 1);
|
||||
g_io_channel_shutdown (vt->io, TRUE, NULL);
|
||||
g_io_channel_unref (vt->io);
|
||||
vt->io = NULL;
|
||||
pt_write (MOO_TERM_PT (pt), "\4", 1);
|
||||
g_io_channel_shutdown (pt->io, TRUE, NULL);
|
||||
g_io_channel_unref (pt->io);
|
||||
pt->io = NULL;
|
||||
}
|
||||
|
||||
stop_writer (vt_gen);
|
||||
vt_flush_pending_write (vt_gen);
|
||||
stop_writer (pt_gen);
|
||||
pt_flush_pending_write (pt_gen);
|
||||
|
||||
if (vt->master != -1)
|
||||
if (pt->master != -1)
|
||||
{
|
||||
_vte_pty_close (vt->master);
|
||||
vt->master = -1;
|
||||
_vte_pty_close (pt->master);
|
||||
pt->master = -1;
|
||||
}
|
||||
|
||||
vt->non_block = FALSE;
|
||||
pt->non_block = FALSE;
|
||||
|
||||
vt->child_pid = (GPid)-1;
|
||||
pt->child_pid = (GPid)-1;
|
||||
|
||||
if (vt->child_alive)
|
||||
if (pt->child_alive)
|
||||
{
|
||||
vt->child_alive = FALSE;
|
||||
g_signal_emit_by_name (vt, "child-died");
|
||||
pt->child_alive = FALSE;
|
||||
g_signal_emit_by_name (pt, "child-died");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static gboolean read_child_out (G_GNUC_UNUSED GIOChannel *source,
|
||||
GIOCondition condition,
|
||||
MooTermVtUnix *vt)
|
||||
MooTermPtUnix *pt)
|
||||
{
|
||||
gboolean error_occured = FALSE;
|
||||
int error_no = 0;
|
||||
@ -327,9 +327,9 @@ static gboolean read_child_out (G_GNUC_UNUSED GIOChannel *source,
|
||||
|
||||
g_assert (condition & (G_IO_IN | G_IO_PRI));
|
||||
|
||||
if (vt->non_block)
|
||||
if (pt->non_block)
|
||||
{
|
||||
int r = read (vt->master, buf, READ_BUFSIZE);
|
||||
int r = read (pt->master, buf, READ_BUFSIZE);
|
||||
|
||||
switch (r)
|
||||
{
|
||||
@ -347,7 +347,7 @@ static gboolean read_child_out (G_GNUC_UNUSED GIOChannel *source,
|
||||
_moo_term_print_bytes (buf, r);
|
||||
g_print ("'\n");
|
||||
#endif
|
||||
feed_buffer (vt, buf, r);
|
||||
feed_buffer (pt, buf, r);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ static gboolean read_child_out (G_GNUC_UNUSED GIOChannel *source,
|
||||
|
||||
while (again && !error_occured && current < READ_BUFSIZE)
|
||||
{
|
||||
struct pollfd fd = {vt->master, POLLIN | POLLPRI, 0};
|
||||
struct pollfd fd = {pt->master, POLLIN | POLLPRI, 0};
|
||||
|
||||
int res = poll (&fd, 1, POLL_TIME);
|
||||
|
||||
@ -378,7 +378,7 @@ static gboolean read_child_out (G_GNUC_UNUSED GIOChannel *source,
|
||||
}
|
||||
else if (fd.revents & (POLLIN | POLLPRI))
|
||||
{
|
||||
int r = read (vt->master, buf + current, 1);
|
||||
int r = read (pt->master, buf + current, 1);
|
||||
|
||||
switch (r)
|
||||
{
|
||||
@ -419,7 +419,7 @@ static gboolean read_child_out (G_GNUC_UNUSED GIOChannel *source,
|
||||
}
|
||||
|
||||
if (current > 0)
|
||||
feed_buffer (vt, buf, current);
|
||||
feed_buffer (pt, buf, current);
|
||||
|
||||
if (error_occured)
|
||||
goto error;
|
||||
@ -433,29 +433,29 @@ error:
|
||||
if (error_no)
|
||||
g_message ("%s: %s", G_STRLOC, g_strerror (error_no));
|
||||
|
||||
if (vt->io)
|
||||
if (pt->io)
|
||||
{
|
||||
_vte_pty_close (vt->master);
|
||||
vt->master = -1;
|
||||
_vte_pty_close (pt->master);
|
||||
pt->master = -1;
|
||||
|
||||
g_io_channel_shutdown (vt->io, TRUE, NULL);
|
||||
g_io_channel_unref (vt->io);
|
||||
vt->io = NULL;
|
||||
g_io_channel_shutdown (pt->io, TRUE, NULL);
|
||||
g_io_channel_unref (pt->io);
|
||||
pt->io = NULL;
|
||||
|
||||
vt->io_watch_id = 0;
|
||||
pt->io_watch_id = 0;
|
||||
}
|
||||
|
||||
kill_child (MOO_TERM_VT (vt));
|
||||
kill_child (MOO_TERM_PT (pt));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void feed_buffer (MooTermVtUnix *vt,
|
||||
static void feed_buffer (MooTermPtUnix *pt,
|
||||
const char *string,
|
||||
int len)
|
||||
{
|
||||
moo_term_buffer_write (moo_term_vt_get_buffer (MOO_TERM_VT (vt)),
|
||||
moo_term_buffer_write (moo_term_pt_get_buffer (MOO_TERM_PT (pt)),
|
||||
string, len);
|
||||
}
|
||||
|
||||
@ -463,18 +463,18 @@ static void feed_buffer (MooTermVtUnix *vt,
|
||||
/* writes given data to file, returns TRUE on successful write,
|
||||
FALSE when could not write al teh data, puts start of leftover
|
||||
to string, length of it to len, and fills err in case of error */
|
||||
static gboolean do_write (MooTermVt *vt_gen,
|
||||
static gboolean do_write (MooTermPt *pt_gen,
|
||||
const char **string,
|
||||
guint *plen,
|
||||
int *err)
|
||||
{
|
||||
int written;
|
||||
|
||||
MooTermVtUnix *vt = MOO_TERM_VT_UNIX (vt_gen);
|
||||
MooTermPtUnix *pt = MOO_TERM_PT_UNIX (pt_gen);
|
||||
|
||||
g_return_val_if_fail (vt->io != NULL, FALSE);
|
||||
g_return_val_if_fail (pt->io != NULL, FALSE);
|
||||
|
||||
written = write (vt->master, *string, *plen > CHUNK_SIZE ? CHUNK_SIZE : *plen);
|
||||
written = write (pt->master, *string, *plen > CHUNK_SIZE ? CHUNK_SIZE : *plen);
|
||||
|
||||
if (written == -1)
|
||||
{
|
||||
@ -504,63 +504,63 @@ static gboolean do_write (MooTermVt *vt_gen,
|
||||
}
|
||||
|
||||
|
||||
static void append (MooTermVt *vt,
|
||||
static void append (MooTermPt *pt,
|
||||
const char *data,
|
||||
guint len)
|
||||
{
|
||||
GByteArray *ar = g_byte_array_sized_new (len);
|
||||
g_byte_array_append (ar, (const guint8*)data, len);
|
||||
g_queue_push_tail (vt->priv->pending_write, ar);
|
||||
g_queue_push_tail (pt->priv->pending_write, ar);
|
||||
}
|
||||
|
||||
|
||||
static gboolean write_cb (MooTermVt *vt)
|
||||
static gboolean write_cb (MooTermPt *pt)
|
||||
{
|
||||
vt_write (vt, NULL, 0);
|
||||
pt_write (pt, NULL, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void start_writer (MooTermVt *vt)
|
||||
static void start_writer (MooTermPt *pt)
|
||||
{
|
||||
if (!vt->priv->pending_write_id)
|
||||
vt->priv->pending_write_id =
|
||||
g_idle_add_full (VT_WRITER_PRIORITY,
|
||||
if (!pt->priv->pending_write_id)
|
||||
pt->priv->pending_write_id =
|
||||
g_idle_add_full (PT_WRITER_PRIORITY,
|
||||
(GSourceFunc) write_cb,
|
||||
vt, NULL);
|
||||
pt, NULL);
|
||||
}
|
||||
|
||||
static void stop_writer (MooTermVt *vt)
|
||||
static void stop_writer (MooTermPt *pt)
|
||||
{
|
||||
if (vt->priv->pending_write_id)
|
||||
if (pt->priv->pending_write_id)
|
||||
{
|
||||
g_source_remove (vt->priv->pending_write_id);
|
||||
vt->priv->pending_write_id = 0;
|
||||
g_source_remove (pt->priv->pending_write_id);
|
||||
pt->priv->pending_write_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void vt_write (MooTermVt *vt,
|
||||
static void pt_write (MooTermPt *pt,
|
||||
const char *data,
|
||||
int data_len)
|
||||
{
|
||||
g_return_if_fail (data == NULL || data_len != 0);
|
||||
|
||||
while (data || !g_queue_is_empty (vt->priv->pending_write))
|
||||
while (data || !g_queue_is_empty (pt->priv->pending_write))
|
||||
{
|
||||
int err = 0;
|
||||
const char *string;
|
||||
guint len;
|
||||
GByteArray *freeme = NULL;
|
||||
|
||||
if (!g_queue_is_empty (vt->priv->pending_write))
|
||||
if (!g_queue_is_empty (pt->priv->pending_write))
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
append (vt, data, data_len > 0 ? (guint)data_len : strlen (data));
|
||||
append (pt, data, data_len > 0 ? (guint)data_len : strlen (data));
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
freeme = g_queue_peek_head (vt->priv->pending_write);
|
||||
freeme = g_queue_peek_head (pt->priv->pending_write);
|
||||
string = freeme->data;
|
||||
len = freeme->len;
|
||||
}
|
||||
@ -571,7 +571,7 @@ static void vt_write (MooTermVt *vt,
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
if (do_write (vt, &string, &len, &err))
|
||||
if (do_write (pt, &string, &len, &err))
|
||||
{
|
||||
if (len)
|
||||
{
|
||||
@ -582,7 +582,7 @@ static void vt_write (MooTermVt *vt,
|
||||
}
|
||||
else
|
||||
{
|
||||
append (vt, string, len);
|
||||
append (pt, string, len);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -590,7 +590,7 @@ static void vt_write (MooTermVt *vt,
|
||||
else if (freeme)
|
||||
{
|
||||
g_byte_array_free (freeme, TRUE);
|
||||
g_queue_pop_head (vt->priv->pending_write);
|
||||
g_queue_pop_head (pt->priv->pending_write);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -598,12 +598,12 @@ static void vt_write (MooTermVt *vt,
|
||||
g_message ("%s: stopping writing to child", G_STRLOC);
|
||||
if (err)
|
||||
g_message ("%s: %s", G_STRLOC, g_strerror (err));
|
||||
kill_child (vt);
|
||||
kill_child (pt);
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_queue_is_empty (vt->priv->pending_write))
|
||||
start_writer (vt);
|
||||
if (!g_queue_is_empty (pt->priv->pending_write))
|
||||
start_writer (pt);
|
||||
else
|
||||
stop_writer (vt);
|
||||
stop_writer (pt);
|
||||
}
|
@ -11,6 +11,6 @@
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#include "mooterm/mootermvt.h"
|
||||
#include "mooterm/mootermpt.h"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* mooterm/mootermvt.c
|
||||
* mooterm/mootermpt.c
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
@ -17,19 +17,19 @@
|
||||
#include "mooutils/moocompat.h"
|
||||
|
||||
|
||||
static void moo_term_vt_set_property (GObject *object,
|
||||
static void moo_term_pt_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void moo_term_vt_get_property (GObject *object,
|
||||
static void moo_term_pt_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void moo_term_vt_finalize (GObject *object);
|
||||
static void moo_term_pt_finalize (GObject *object);
|
||||
|
||||
|
||||
/* MOO_TYPE_TERM_VT */
|
||||
G_DEFINE_TYPE (MooTermVt, moo_term_vt, G_TYPE_OBJECT)
|
||||
/* MOO_TYPE_TERM_PT */
|
||||
G_DEFINE_TYPE (MooTermPt, moo_term_pt, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
CHILD_DIED,
|
||||
@ -44,13 +44,13 @@ enum {
|
||||
static guint signals[LAST_SIGNAL];
|
||||
|
||||
|
||||
static void moo_term_vt_class_init (MooTermVtClass *klass)
|
||||
static void moo_term_pt_class_init (MooTermPtClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = moo_term_vt_set_property;
|
||||
gobject_class->get_property = moo_term_vt_get_property;
|
||||
gobject_class->finalize = moo_term_vt_finalize;
|
||||
gobject_class->set_property = moo_term_pt_set_property;
|
||||
gobject_class->get_property = moo_term_pt_get_property;
|
||||
gobject_class->finalize = moo_term_pt_finalize;
|
||||
|
||||
klass->set_size = NULL;
|
||||
klass->fork_command = NULL;
|
||||
@ -62,7 +62,7 @@ static void moo_term_vt_class_init (MooTermVtClass *klass)
|
||||
g_signal_new ("child-died",
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (MooTermVtClass, child_died),
|
||||
G_STRUCT_OFFSET (MooTermPtClass, child_died),
|
||||
NULL, NULL,
|
||||
_moo_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
@ -77,39 +77,39 @@ static void moo_term_vt_class_init (MooTermVtClass *klass)
|
||||
}
|
||||
|
||||
|
||||
static void moo_term_vt_init (MooTermVt *vt)
|
||||
static void moo_term_pt_init (MooTermPt *pt)
|
||||
{
|
||||
vt->priv = g_new0 (MooTermVtPrivate, 1);
|
||||
vt->priv->pending_write = g_queue_new ();
|
||||
pt->priv = g_new0 (MooTermPtPrivate, 1);
|
||||
pt->priv->pending_write = g_queue_new ();
|
||||
}
|
||||
|
||||
|
||||
static void moo_term_vt_finalize (GObject *object)
|
||||
static void moo_term_pt_finalize (GObject *object)
|
||||
{
|
||||
MooTermVt *vt = MOO_TERM_VT (object);
|
||||
MooTermPt *pt = MOO_TERM_PT (object);
|
||||
|
||||
if (vt->priv->buffer)
|
||||
g_object_unref (vt->priv->buffer);
|
||||
if (pt->priv->buffer)
|
||||
g_object_unref (pt->priv->buffer);
|
||||
|
||||
vt_flush_pending_write (vt);
|
||||
g_queue_free (vt->priv->pending_write);
|
||||
pt_flush_pending_write (pt);
|
||||
g_queue_free (pt->priv->pending_write);
|
||||
|
||||
g_free (vt->priv);
|
||||
g_free (pt->priv);
|
||||
|
||||
G_OBJECT_CLASS (moo_term_vt_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (moo_term_pt_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
static void moo_term_vt_set_property (GObject *object,
|
||||
static void moo_term_pt_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MooTermVt *vt = MOO_TERM_VT (object);
|
||||
MooTermPt *pt = MOO_TERM_PT (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_BUFFER:
|
||||
moo_term_vt_set_buffer (vt, g_value_get_object (value));
|
||||
moo_term_pt_set_buffer (pt, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -119,16 +119,16 @@ static void moo_term_vt_set_property (GObject *object,
|
||||
}
|
||||
|
||||
|
||||
static void moo_term_vt_get_property (GObject *object,
|
||||
static void moo_term_pt_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MooTermVt *vt = MOO_TERM_VT (object);
|
||||
MooTermPt *pt = MOO_TERM_PT (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_BUFFER:
|
||||
g_value_set_object (value, vt->priv->buffer);
|
||||
g_value_set_object (value, pt->priv->buffer);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -138,68 +138,68 @@ static void moo_term_vt_get_property (GObject *object,
|
||||
}
|
||||
|
||||
|
||||
void moo_term_vt_set_buffer (MooTermVt *vt,
|
||||
void moo_term_pt_set_buffer (MooTermPt *pt,
|
||||
MooTermBuffer *buffer)
|
||||
{
|
||||
if (vt->priv->buffer == buffer)
|
||||
if (pt->priv->buffer == buffer)
|
||||
return;
|
||||
|
||||
if (vt->priv->buffer)
|
||||
g_object_unref (vt->priv->buffer);
|
||||
vt->priv->buffer = buffer;
|
||||
if (vt->priv->buffer)
|
||||
g_object_ref (vt->priv->buffer);
|
||||
if (pt->priv->buffer)
|
||||
g_object_unref (pt->priv->buffer);
|
||||
pt->priv->buffer = buffer;
|
||||
if (pt->priv->buffer)
|
||||
g_object_ref (pt->priv->buffer);
|
||||
|
||||
g_object_notify (G_OBJECT (vt), "buffer");
|
||||
g_object_notify (G_OBJECT (pt), "buffer");
|
||||
}
|
||||
|
||||
|
||||
MooTermBuffer *moo_term_vt_get_buffer (MooTermVt *vt)
|
||||
MooTermBuffer *moo_term_pt_get_buffer (MooTermPt *pt)
|
||||
{
|
||||
return vt->priv->buffer;
|
||||
return pt->priv->buffer;
|
||||
}
|
||||
|
||||
|
||||
MooTermVt *moo_term_vt_new (void)
|
||||
MooTermPt *moo_term_pt_new (void)
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
return g_object_new (MOO_TYPE_TERM_VT_WIN, NULL);
|
||||
return g_object_new (MOO_TYPE_TERM_PT_WIN, NULL);
|
||||
#else /* !__WIN32__ */
|
||||
return g_object_new (MOO_TYPE_TERM_VT_UNIX, NULL);
|
||||
return g_object_new (MOO_TYPE_TERM_PT_UNIX, NULL);
|
||||
#endif /* !__WIN32__ */
|
||||
}
|
||||
|
||||
|
||||
void moo_term_vt_set_size (MooTermVt *vt,
|
||||
void moo_term_pt_set_size (MooTermPt *pt,
|
||||
guint width,
|
||||
guint height)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TERM_VT (vt));
|
||||
MOO_TERM_VT_GET_CLASS(vt)->set_size (vt, width, height);
|
||||
g_return_if_fail (MOO_IS_TERM_PT (pt));
|
||||
MOO_TERM_PT_GET_CLASS(pt)->set_size (pt, width, height);
|
||||
}
|
||||
|
||||
|
||||
gboolean moo_term_vt_fork_command (MooTermVt *vt,
|
||||
gboolean moo_term_pt_fork_command (MooTermPt *pt,
|
||||
const char *cmd,
|
||||
const char *working_dir,
|
||||
char **envp)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_TERM_VT (vt), FALSE);
|
||||
return MOO_TERM_VT_GET_CLASS(vt)->fork_command (vt, cmd, working_dir, envp);
|
||||
g_return_val_if_fail (MOO_IS_TERM_PT (pt), FALSE);
|
||||
return MOO_TERM_PT_GET_CLASS(pt)->fork_command (pt, cmd, working_dir, envp);
|
||||
}
|
||||
|
||||
|
||||
void moo_term_vt_kill_child (MooTermVt *vt)
|
||||
void moo_term_pt_kill_child (MooTermPt *pt)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TERM_VT (vt));
|
||||
MOO_TERM_VT_GET_CLASS(vt)->kill_child (vt);
|
||||
g_return_if_fail (MOO_IS_TERM_PT (pt));
|
||||
MOO_TERM_PT_GET_CLASS(pt)->kill_child (pt);
|
||||
}
|
||||
|
||||
|
||||
void moo_term_vt_write (MooTermVt *vt,
|
||||
void moo_term_pt_write (MooTermPt *pt,
|
||||
const char *data,
|
||||
gssize len)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TERM_VT (vt));
|
||||
MOO_TERM_VT_GET_CLASS(vt)->write (vt, data, len);
|
||||
g_return_if_fail (MOO_IS_TERM_PT (pt));
|
||||
MOO_TERM_PT_GET_CLASS(pt)->write (pt, data, len);
|
||||
}
|
91
moo/mooterm/mootermpt.h
Normal file
91
moo/mooterm/mootermpt.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* mooterm/mootermpt.h
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef MOOTERM_MOOTERMPT_H
|
||||
#define MOOTERM_MOOTERMPT_H
|
||||
|
||||
#include "mooterm/mootermbuffer.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_TERM_PT (moo_term_pt_get_type ())
|
||||
#define MOO_TYPE_TERM_PT_WIN (moo_term_pt_win_get_type ())
|
||||
#define MOO_TYPE_TERM_PT_UNIX (moo_term_pt_unix_get_type ())
|
||||
|
||||
#define MOO_TERM_PT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_TERM_PT, MooTermPt))
|
||||
#define MOO_TERM_PT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_TERM_PT, MooTermPtClass))
|
||||
#define MOO_IS_TERM_PT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_TERM_PT))
|
||||
#define MOO_IS_TERM_PT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_TERM_PT))
|
||||
#define MOO_TERM_PT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_TERM_PT, MooTermPtClass))
|
||||
|
||||
typedef struct _MooTermPt MooTermPt;
|
||||
typedef struct _MooTermPtPrivate MooTermPtPrivate;
|
||||
typedef struct _MooTermPtClass MooTermPtClass;
|
||||
|
||||
|
||||
struct _MooTermPt {
|
||||
GObject parent;
|
||||
MooTermPtPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MooTermPtClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* virtual methods */
|
||||
void (*set_size) (MooTermPt *pt,
|
||||
guint width,
|
||||
guint height);
|
||||
gboolean (*fork_command) (MooTermPt *pt,
|
||||
const char *cmd,
|
||||
const char *working_dir,
|
||||
char **envp);
|
||||
void (*write) (MooTermPt *pt,
|
||||
const char *data,
|
||||
gssize len);
|
||||
void (*kill_child) (MooTermPt *pt);
|
||||
|
||||
/* signals */
|
||||
void (*child_died) (MooTermPt *pt);
|
||||
};
|
||||
|
||||
|
||||
GType moo_term_pt_get_type (void) G_GNUC_CONST;
|
||||
GType moo_term_pt_unix_get_type (void) G_GNUC_CONST;
|
||||
GType moo_term_pt_win_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* creates MooTermPtWin or MooTermPtUnix instance, depending on platform */
|
||||
MooTermPt *moo_term_pt_new (void);
|
||||
|
||||
void moo_term_pt_set_buffer (MooTermPt *pt,
|
||||
MooTermBuffer *buffer);
|
||||
MooTermBuffer *moo_term_pt_get_buffer (MooTermPt *pt);
|
||||
|
||||
void moo_term_pt_set_size (MooTermPt *pt,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
gboolean moo_term_pt_fork_command (MooTermPt *pt,
|
||||
const char *cmd,
|
||||
const char *working_dir,
|
||||
char **envp);
|
||||
void moo_term_pt_kill_child (MooTermPt *pt);
|
||||
|
||||
void moo_term_pt_write (MooTermPt *pt,
|
||||
const char *data,
|
||||
gssize len);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOOTERM_MOOTERMPT_H */
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* mooterm/mootermvt.h
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef MOOTERM_MOOTERMVT_H
|
||||
#define MOOTERM_MOOTERMVT_H
|
||||
|
||||
#include "mooterm/mootermbuffer.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_TERM_VT (moo_term_vt_get_type ())
|
||||
#define MOO_TYPE_TERM_VT_WIN (moo_term_vt_win_get_type ())
|
||||
#define MOO_TYPE_TERM_VT_UNIX (moo_term_vt_unix_get_type ())
|
||||
|
||||
#define MOO_TERM_VT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_TERM_VT, MooTermVt))
|
||||
#define MOO_TERM_VT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_TERM_VT, MooTermVtClass))
|
||||
#define MOO_IS_TERM_VT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_TERM_VT))
|
||||
#define MOO_IS_TERM_VT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_TERM_VT))
|
||||
#define MOO_TERM_VT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_TERM_VT, MooTermVtClass))
|
||||
|
||||
typedef struct _MooTermVt MooTermVt;
|
||||
typedef struct _MooTermVtPrivate MooTermVtPrivate;
|
||||
typedef struct _MooTermVtClass MooTermVtClass;
|
||||
|
||||
|
||||
struct _MooTermVt {
|
||||
GObject parent;
|
||||
MooTermVtPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MooTermVtClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* virtual methods */
|
||||
void (*set_size) (MooTermVt *vt,
|
||||
guint width,
|
||||
guint height);
|
||||
gboolean (*fork_command) (MooTermVt *vt,
|
||||
const char *cmd,
|
||||
const char *working_dir,
|
||||
char **envp);
|
||||
void (*write) (MooTermVt *vt,
|
||||
const char *data,
|
||||
gssize len);
|
||||
void (*kill_child) (MooTermVt *vt);
|
||||
|
||||
/* signals */
|
||||
void (*child_died) (MooTermVt *vt);
|
||||
};
|
||||
|
||||
|
||||
GType moo_term_vt_get_type (void) G_GNUC_CONST;
|
||||
GType moo_term_vt_unix_get_type (void) G_GNUC_CONST;
|
||||
GType moo_term_vt_win_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* creates MooTermVtWin or MooTermVtUnix instance, depending on platform */
|
||||
MooTermVt *moo_term_vt_new (void);
|
||||
|
||||
void moo_term_vt_set_buffer (MooTermVt *vt,
|
||||
MooTermBuffer *buffer);
|
||||
MooTermBuffer *moo_term_vt_get_buffer (MooTermVt *vt);
|
||||
|
||||
void moo_term_vt_set_size (MooTermVt *vt,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
gboolean moo_term_vt_fork_command (MooTermVt *vt,
|
||||
const char *cmd,
|
||||
const char *working_dir,
|
||||
char **envp);
|
||||
void moo_term_vt_kill_child (MooTermVt *vt);
|
||||
|
||||
void moo_term_vt_write (MooTermVt *vt,
|
||||
const char *data,
|
||||
gssize len);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOOTERM_MOOTERMVT_H */
|
Loading…
x
Reference in New Issue
Block a user