This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Attached is a patch against vte-0.11.11 that adds vte_terminal_set_pty(). It's based on the patch included in GNOME bug #135230 "Feature request to attach VTE to existing pty" and incorporates Nalin Dahyabhai suggestions. Chris Moller
--- vte-0.11.11/src/vte.c 2004-05-02 02:43:01.000000000 -0400
+++ vte-0.11.11-with-add-pty-patch/src/vte.c 2006-03-14 14:42:18.022660403 -0500
@@ -7251,7 +7251,49 @@
return ret;
}
+/**
+ * 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.
+ */
+gboolean
+vte_terminal_set_pty(VteTerminal *terminal, int pty_master)
+{
+ GtkWidget *widget;
+ int i;
+
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
+ 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);
+
+ return TRUE;
+}
+
+
/* Handle an EOF from the client. */
static void
vte_terminal_eof(GIOChannel *channel, gpointer data)
--- vte-0.11.11/src/vte.h 2004-05-01 03:12:51.000000000 -0400
+++ vte-0.11.11-with-add-pty-patch/src/vte.h 2006-03-14 14:34:38.065332308 -0500
@@ -217,6 +217,10 @@
gboolean utmp,
gboolean wtmp);
+/* Attach an existing PTY master side to the terminal widget. Use
+ * instead of vte_terminal_fork_command. */
+gboolean vte_terminal_set_pty(VteTerminal *terminal, int pty_master);
+
/* Send data to the terminal to display, or to the terminal's forked command
* to handle in some way. If it's 'cat', they should be the same. */
void vte_terminal_feed(VteTerminal *terminal, const char *data, glong length);
Attachment:
signature.asc
Description: OpenPGP digital signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |