Commit 431eba9f authored by Behdad Esfahbod's avatar Behdad Esfahbod Committed by Behdad Esfahbod
Browse files

Bug 135230 – Feature request to attach VTE to existing pty Based on

2006-04-19  Behdad Esfahbod  <behdad@gnome.org>

        Bug 135230 – Feature request to attach VTE to existing pty
        Based on patch from eric@brouhaha.com, John Swensen, and
        Chris Moller  <cmoller@redhat.com>

        * src/vte.c:
        * src/vte.h:
        * python/vte.defs:
        * doc/reference/vte-sections.txt: Added vte_terminal_set_pty().
parent f5a7397b
2006-04-19 Behdad Esfahbod <behdad@gnome.org>
Bug 135230 Feature request to attach VTE to existing pty
Based on patch from eric@brouhaha.com, John Swensen, and
Chris Moller <cmoller@redhat.com>
* src/vte.c:
* src/vte.h:
* python/vte.defs:
* doc/reference/vte-sections.txt: Added vte_terminal_set_pty().
2006-04-18 Behdad Esfahbod <behdad@gnome.org>
Bug 337442 [patch] Reduce .plt section
......
......@@ -299,6 +299,17 @@ keys.
@Returns:
<!-- ##### FUNCTION vte_terminal_set_pty ##### -->
<para>
</para>
@terminal:
@pty_master:
<!-- # Unused Parameters # -->
@Returns:
<!-- ##### FUNCTION vte_terminal_feed ##### -->
<para>
......
......@@ -7,6 +7,7 @@ vte_terminal_new
vte_terminal_im_append_menuitems
vte_terminal_fork_command
vte_terminal_forkpty
vte_terminal_set_pty
vte_terminal_feed
vte_terminal_feed_child
vte_terminal_copy_clipboard
......
......@@ -74,8 +74,18 @@
(define-method forkpty
(of-object "VteTerminal")
(c-name "vte_terminal_forkpty")
(parameters
'("pid_t" "pty_master")
)
)
(define-method set_pty
(of-object "VteTerminal")
(c-name "vte_terminal_set_pty")
(return-type "pid_t")
(parameters
'("const-char*" "command")
'("char**" "argv")
'("char**" "envv")
'("const-char*" "directory")
'("gboolean" "lastlog")
......
......@@ -11087,6 +11087,45 @@ vte_terminal_get_icon_title(VteTerminal *terminal)
return terminal->icon_title;
}
/**
* vte_terminal_set_pty:
* @terminal: a #VteTerminal
* @pty_master: a file descriptor of the master end of a PTY
*
* Attach an existing PTY master side to the terminal widget. Use
* instead of vte_terminal_fork_command() or vte_terminal_forkpty().
*/
void
vte_terminal_set_pty(VteTerminal *terminal, int pty_master)
{
GtkWidget *widget;
int i;
g_return_if_fail(VTE_IS_TERMINAL(terminal));
widget = GTK_WIDGET(terminal);
if (terminal->pvt->pty_master != -1) {
_vte_pty_close(terminal->pvt->pty_master);
close(terminal->pvt->pty_master);
}
terminal->pvt->pty_master = pty_master;
/* Set the pty to be non-blocking. */
i = fcntl(terminal->pvt->pty_master, F_GETFL);
fcntl(terminal->pvt->pty_master, F_SETFL, i | O_NONBLOCK);
vte_terminal_set_size(terminal,
terminal->column_count,
terminal->row_count);
/* Open channels to listen for input on. */
_vte_terminal_connect_pty_read(terminal);
/* Open channels to write output to. */
_vte_terminal_connect_pty_write(terminal);
}
/* We need this bit of glue to ensure that accessible objects will always
* get signals. */
void
......
......@@ -390,6 +390,10 @@ const char *vte_terminal_get_status_line(VteTerminal *terminal);
/* Get the padding the widget is using. */
void vte_terminal_get_padding(VteTerminal *terminal, int *xpad, int *ypad);
/* Attach an existing PTY master side to the terminal widget. Use
* instead of vte_terminal_fork_command(). */
void vte_terminal_set_pty(VteTerminal *terminal, int pty_master);
/* Accessors for bindings. */
GtkAdjustment *vte_terminal_get_adjustment(VteTerminal *terminal);
glong vte_terminal_get_char_width(VteTerminal *terminal);
......
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