Re: Help about VteTerminal



Brian wrote:

On Mon, 2004-12-06 at 14:07 +0800, Shixin Zeng wrote:
Thanks.
With this method, I managed to get the output, but also the input from user. So I have to distinguish the input and output, but how can I distinguish them?


The "commit" signal
void        user_function                  (VteTerminal *vteterminal,
                                           gchar *arg1,
                                           guint arg2,
                                           gpointer user_data);

Emitted whenever the terminal receives input from the user and prepares
to send it to the child process. The signal is emitted even when there
is no child process.

vteterminal :
the object which received the
signal.


arg1 :
a string of text.


arg2 :
the length of that string of text.


user_data :
user data set when the signal
handler was connected.



Sorry, if I didn't express myself well in the last e-mail.
Now let me elaborate on it.

my code segment is like:

typedef struct{
 glong row;
 glong col;
}cursor_position;

void
cursor_moved(VteTerminal *vte, gpointer original_position)
{
 cursor_position *orig_pos = (cursor_position*)original_position;
 /* get the cursor position */
 glong col=0, row=0;
 vte_terminal_get_cursor_position(vte, &col, &row);
 gchar *content = vte_terminal_get_text_range(vte,
                          orig_pos->row,
                          orig_pos->col,
                          row,
                          col,
                          is_selected,
                          NULL,
                          NULL);
printf("Received from the Child %s\n", content); */* here,
* @content contains both the output from the child * AND the input from the user. * What I want is just the output from the child.
                                                                        */*
g_free(content);
}

cursor_position *init_pos = g_new0(cursor_position, 1);
g_signal_connect(G_OBJECT(terminal), "cursor-moved", G_CALLBACK(cursor_moved), init_pos);
g_free(init_pos);




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]