linux学习记录
分类:
2008-09-25 15:25:58
VteTerminalVteTerminal — A terminal widget implementation. |
VteTerminal;
enum VteTerminalEraseBinding;GtkWidget * vte_terminal_new (void);void vte_terminal_im_append_menuitems (VteTerminal *terminal,
GtkMenuShell *menushell);pid_t vte_terminal_fork_command (VteTerminal *terminal,
constchar *command,
char **argv,
char **envv,
constchar *directory,
gboolean lastlog,
gboolean utmp,
gboolean wtmp);pid_t vte_terminal_forkpty (VteTerminal *terminal,
char **envv,
constchar *directory,
gboolean lastlog,
gboolean utmp,
gboolean wtmp);void vte_terminal_set_pty (VteTerminal *terminal,
int pty_master);void vte_terminal_feed (VteTerminal *terminal,
constchar *data,
glong length);void vte_terminal_feed_child (VteTerminal *terminal,
constchar *text,
glong length);void vte_terminal_feed_child_binary (VteTerminal *terminal,
constchar *data,
glong length);void vte_terminal_select_all (VteTerminal *terminal);void vte_terminal_select_none (VteTerminal *terminal);void vte_terminal_copy_clipboard (VteTerminal *terminal);void vte_terminal_paste_clipboard (VteTerminal *terminal);void vte_terminal_copy_primary (VteTerminal *terminal);void vte_terminal_paste_primary (VteTerminal *terminal);void vte_terminal_set_size (VteTerminal *terminal,
glong columns,
glong rows);void vte_terminal_set_audible_bell (VteTerminal *terminal,
gboolean is_audible);gboolean vte_terminal_get_audible_bell (VteTerminal *terminal);void vte_terminal_set_visible_bell (VteTerminal *terminal,
gboolean is_visible);gboolean vte_terminal_get_visible_bell (VteTerminal *terminal);void vte_terminal_set_allow_bold (VteTerminal *terminal,
gboolean allow_bold);gboolean vte_terminal_get_allow_bold (VteTerminal *terminal);void vte_terminal_set_scroll_on_output (VteTerminal *terminal,
gboolean scroll);void vte_terminal_set_scroll_on_keystroke
(VteTerminal *terminal,
gboolean scroll);void vte_terminal_set_color_bold (VteTerminal *terminal,
constGdkColor *bold);void vte_terminal_set_color_foreground (VteTerminal *terminal,
constGdkColor *foreground);void vte_terminal_set_color_background (VteTerminal *terminal,
constGdkColor *background);void vte_terminal_set_color_dim (VteTerminal *terminal,
constGdkColor *dim);void vte_terminal_set_color_cursor (VteTerminal *terminal,
constGdkColor *cursor_background);void vte_terminal_set_color_highlight (VteTerminal *terminal,
constGdkColor *highlight_background);void vte_terminal_set_colors (VteTerminal *terminal,
constGdkColor *foreground,
constGdkColor *background,
constGdkColor *palette,
glong palette_size);void vte_terminal_set_default_colors (VteTerminal *terminal);void vte_terminal_set_opacity (VteTerminal *terminal,
guint16 opacity);void vte_terminal_set_background_image (VteTerminal *terminal,
GdkPixbuf *image);void vte_terminal_set_background_image_file
(VteTerminal *terminal,
constchar *path);void vte_terminal_set_background_saturation
(VteTerminal *terminal,
double saturation);void vte_terminal_set_background_transparent
(VteTerminal *terminal,
gboolean transparent);void vte_terminal_set_background_tint_color
(VteTerminal *terminal,
constGdkColor *color);void vte_terminal_set_scroll_background (VteTerminal *terminal,
gboolean scroll);void vte_terminal_set_cursor_blinks (VteTerminal *terminal,
gboolean blink);VteTerminalCursorBlinkMode vte_terminal_get_cursor_blink_mode
(VteTerminal *terminal);void vte_terminal_set_cursor_blink_mode (VteTerminal *terminal,
VteTerminalCursorBlinkMode mode);void vte_terminal_set_scrollback_lines (VteTerminal *terminal,
glong lines);void vte_terminal_set_font (VteTerminal *terminal,
constPangoFontDescription *font_desc);void vte_terminal_set_font_from_string (VteTerminal *terminal,
constchar *name);void vte_terminal_set_font_from_string_full
(VteTerminal *terminal,
constchar *name,
VteTerminalAntiAlias antialias);void vte_terminal_set_font_full (VteTerminal *terminal,
constPangoFontDescription *font_desc,
VteTerminalAntiAlias antialias);
constPangoFontDescription * vte_terminal_get_font (VteTerminal *terminal);gboolean vte_terminal_get_using_xft (VteTerminal *terminal);gboolean vte_terminal_get_has_selection (VteTerminal *terminal);void vte_terminal_set_word_chars (VteTerminal *terminal,
constchar *spec);gboolean vte_terminal_is_word_char (VteTerminal *terminal,
gunichar c);void vte_terminal_set_backspace_binding (VteTerminal *terminal,
VteTerminalEraseBinding binding);void vte_terminal_set_delete_binding (VteTerminal *terminal,
VteTerminalEraseBinding binding);void vte_terminal_set_mouse_autohide (VteTerminal *terminal,
gboolean setting);gboolean vte_terminal_get_mouse_autohide (VteTerminal *terminal);void vte_terminal_reset (VteTerminal *terminal,
gboolean full,
gboolean clear_history);char * vte_terminal_get_text (VteTerminal *terminal,
gboolean (is_selectedVteTerminal *terminal,glong column,glong row,gpointer data) (),
gpointer data,
GArray *attributes);char * vte_terminal_get_text_include_trailing_spaces
(VteTerminal *terminal,
gboolean (is_selectedVteTerminal *terminal,glong column,glong row,gpointer data) (),
gpointer data,
GArray *attributes);char * vte_terminal_get_text_range (VteTerminal *terminal,
glong start_row,
glong start_col,
glong end_row,
glong end_col,
gboolean (is_selectedVteTerminal *terminal,glong column,glong row,gpointer data) (),
gpointer data,
GArray *attributes);void vte_terminal_get_cursor_position (VteTerminal *terminal,
glong *column,
glong *row);void vte_terminal_match_clear_all (VteTerminal *terminal);int vte_terminal_match_add (VteTerminal *terminal,
constchar *match);int vte_terminal_match_add_gregex (VteTerminal *terminal,
GRegex *regex,
GRegexMatchFlags flags);void vte_terminal_match_remove (VteTerminal *terminal,
int tag);char * vte_terminal_match_check (VteTerminal *terminal,
glong column,
glong row,
int *tag);void vte_terminal_match_set_cursor (VteTerminal *terminal,
int tag,
GdkCursor *cursor);void vte_terminal_match_set_cursor_type (VteTerminal *terminal,
int tag,
GdkCursorType cursor_type);void vte_terminal_match_set_cursor_name (VteTerminal *terminal,
int tag,
constchar *cursor_name);void vte_terminal_set_emulation (VteTerminal *terminal,
constchar *emulation);
constchar * vte_terminal_get_emulation (VteTerminal *terminal);
constchar * vte_terminal_get_default_emulation (VteTerminal *terminal);void vte_terminal_set_encoding (VteTerminal *terminal,
constchar *codeset);
constchar * vte_terminal_get_encoding (VteTerminal *terminal);
constchar * vte_terminal_get_status_line (VteTerminal *terminal);void vte_terminal_get_padding (VteTerminal *terminal,
int *xpad,
int *ypad);GtkAdjustment * vte_terminal_get_adjustment (VteTerminal *terminal);glong vte_terminal_get_char_ascent (VteTerminal *terminal);glong vte_terminal_get_char_descent (VteTerminal *terminal);glong vte_terminal_get_char_height (VteTerminal *terminal);glong vte_terminal_get_char_width (VteTerminal *terminal);glong vte_terminal_get_column_count (VteTerminal *terminal);
constchar * vte_terminal_get_icon_title (VteTerminal *terminal);glong vte_terminal_get_row_count (VteTerminal *terminal);
constchar * vte_terminal_get_window_title (VteTerminal *terminal);
GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----VteTerminal
VteTerminal implements
"char-size-changed" : Run Last
"child-exited" : Run Last
"commit" : Run Last
"contents-changed" : Run Last
"copy-clipboard" : Run Last / Action
"cursor-moved" : Run Last
"decrease-font-size" : Run Last
"deiconify-window" : Run Last
"emulation-changed" : Run Last
"encoding-changed" : Run Last
"eof" : Run Last
"icon-title-changed" : Run Last
"iconify-window" : Run Last
"increase-font-size" : Run Last
"lower-window" : Run Last
"maximize-window" : Run Last
"move-window" : Run Last
"paste-clipboard" : Run Last / Action
"raise-window" : Run Last
"refresh-window" : Run Last
"resize-window" : Run Last
"restore-window" : Run Last
"selection-changed" : Run Last
"set-scroll-adjustments" : Run Last
"status-line-changed" : Run Last
"text-deleted" : Run Last
"text-inserted" : Run Last
"text-modified" : Run Last
"text-scrolled" : Run Last
"window-title-changed" : Run Last
A VteTerminal is a terminal emulator implemented as a GTK2 widget.
typedef struct {
/* Widget implementation stuffs. */
GtkWidget widget;
GtkAdjustment *adjustment; /* Scrolling adjustment. */
/* Metric and sizing data. */
glong char_width, char_height; /* dimensions of character cells */
glong char_ascent, char_descent; /* important font metrics */
glong row_count, column_count; /* dimensions of the window */
/* Titles. */
char *window_title;
char *icon_title;
} VteTerminal;
All of these fields should be considered read-only.
widget ; |
Base |
adjustment ; |
Scroll bar adjustments. |
char_width ; |
Width of a narrow character cell. |
char_height ; |
Height of a character cell. |
char_ascent ; |
The distance (in pixels) from the baseline of drawn text to the top of the character cell. |
char_descent ; |
The distance (in pixels) from the baseline of drawn text to the bottom of the character cell. |
row_count ; |
Number of visible rows. |
column_count ; |
Number of visible columns. |
window_title ; |
The terminal's idea of what the window's title should be. |
icon_title ; |
The terminal's idea of what the window's title should be when iconified. |
typedef enum {
VTE_ERASE_AUTO,
VTE_ERASE_ASCII_BACKSPACE,
VTE_ERASE_ASCII_DELETE,
VTE_ERASE_DELETE_SEQUENCE
} VteTerminalEraseBinding;
An enumerated type which can be used to indicate which string the terminal should send to an application when the user presses the Delete or Backspace keys.
VTE_ERASE_AUTO |
For backspace, attempt to determine the right value from the terminal's IO settings. For delete, use the control sequence. |
VTE_ERASE_ASCII_BACKSPACE |
Send an ASCII backspace character (0x08). |
VTE_ERASE_ASCII_DELETE |
Send an ASCII delete character (0x7F). |
VTE_ERASE_DELETE_SEQUENCE |
Send the "@7 " control sequence.
|
GtkWidget * vte_terminal_new (void);
Create a new terminal widget.
Returns : | a new VteTerminal object |
void vte_terminal_im_append_menuitems (VteTerminal *terminal,
GtkMenuShell *menushell);
Appends menu items for various input methods to the given menu. The user can select one of these items to modify the input method used by the terminal.
terminal : |
a VteTerminal |
menushell : |
a GtkMenuShell |
pid_t vte_terminal_fork_command (VteTerminal *terminal,
constchar *command,
char **argv,
char **envv,
constchar *directory,
gboolean lastlog,
gboolean utmp,
gboolean wtmp);
Starts the specified command under a newly-allocated controlling
pseudo-terminal. The argv
and envv
lists should be NULL
execve()
lastlog
, utmp
, or wtmp
are TRUE
terminal : |
a VteTerminal |
command : |
the name of a binary to run, or NULL |
argv : |
the argument list to be passed to command , or NULL |
envv : |
a list of environment variables to be added to the environment before
starting command , or NULL |
directory : |
the name of a directory the command should start in, or NULL |
lastlog : |
TRUE |
utmp : |
TRUE |
wtmp : |
TRUE |
Returns : | the ID of the new process |
pid_t vte_terminal_forkpty (VteTerminal *terminal,
char **envv,
constchar *directory,
gboolean lastlog,
gboolean utmp,
gboolean wtmp);
Starts a new child process under a newly-allocated controlling
pseudo-terminal. TERM is automatically set to reflect the terminal widget's
emulation setting. If lastlog
, utmp
, or wtmp
are TRUE
terminal : |
a VteTerminal |
envv : |
a list of environment variables to be added to the environment before
starting returning in the child process, or NULL |
directory : |
the name of a directory the child process should change to, or
NULL |
lastlog : |
TRUE |
utmp : |
TRUE |
wtmp : |
TRUE |
Returns : | the ID of the new process in the parent, 0 in the child, and -1 if there was an error |
Since 0.11.11
void vte_terminal_set_pty (VteTerminal *terminal,
int pty_master);
Attach an existing PTY master side to the terminal widget. Use
instead of vte_terminal_fork_command()
or vte_terminal_forkpty()
.
terminal : |
a VteTerminal |
pty_master : |
a file descriptor of the master end of a PTY |
Since 0.12.1
void vte_terminal_feed (VteTerminal *terminal,
constchar *data,
glong length);
Interprets data
as if it were data received from a child process. This
can either be used to drive the terminal without a child process, or just
to mess with your users.
terminal : |
a VteTerminal |
data : |
a string in the terminal's current encoding |
length : |
the length of the string |
void vte_terminal_feed_child (VteTerminal *terminal,
constchar *text,
glong length);
Sends a block of UTF-8 text to the child as if it were entered by the user at the keyboard.
terminal : |
a VteTerminal |
text : |
data to send to the child |
length : |
length of text in bytes, or -1 if text is NUL-terminated
|
void vte_terminal_feed_child_binary (VteTerminal *terminal,
constchar *data,
glong length);
Sends a block of binary data to the child.
terminal : |
a VteTerminal |
data : |
data to send to the child |
length : |
length of data
|
Since 0.12.1
void vte_terminal_select_all (VteTerminal *terminal);
Selects all text within the terminal (including the scrollback buffer).
terminal : |
a VteTerminal |
Since 0.16
void vte_terminal_select_none (VteTerminal *terminal);
Clears the current selection.
terminal : |
a VteTerminal |
Since 0.16
void vte_terminal_copy_clipboard (VteTerminal *terminal);
Places the selected text in the terminal in the
terminal : |
a VteTerminal |
void vte_terminal_paste_clipboard (VteTerminal *terminal);
Sends the contents of the
terminal : |
a VteTerminal |
void vte_terminal_copy_primary (VteTerminal *terminal);
Places the selected text in the terminal in the
terminal : |
a VteTerminal |
void vte_terminal_paste_primary (VteTerminal *terminal);
Sends the contents of the
terminal : |
a VteTerminal |
void vte_terminal_set_size (VteTerminal *terminal,
glong columns,
glong rows);
Attempts to change the terminal's size in terms of rows and columns. If the attempt succeeds, the widget will resize itself to the proper size.
terminal : |
a VteTerminal |
columns : |
the desired number of columns |
rows : |
the desired number of rows |
void vte_terminal_set_audible_bell (VteTerminal *terminal,
gboolean is_audible);
Controls whether or not the terminal will beep when the child outputs the "bl" sequence.
terminal : |
a VteTerminal |
is_audible : |
TRUE |
gboolean vte_terminal_get_audible_bell (VteTerminal *terminal);
Checks whether or not the terminal will beep when the child outputs the "bl" sequence.
terminal : |
a VteTerminal |
Returns : | TRUE FALSE |
void vte_terminal_set_visible_bell (VteTerminal *terminal,
gboolean is_visible);
Controls whether or not the terminal will present a visible bell to the user when the child outputs the "bl" sequence. The terminal will clear itself to the default foreground color and then repaint itself.
terminal : |
a VteTerminal |
is_visible : |
TRUE |
gboolean vte_terminal_get_visible_bell (VteTerminal *terminal);
Checks whether or not the terminal will present a visible bell to the user when the child outputs the "bl" sequence. The terminal will clear itself to the default foreground color and then repaint itself.
terminal : |
a VteTerminal |
Returns : | TRUE FALSE |
void vte_terminal_set_allow_bold (VteTerminal *terminal,
gboolean allow_bold);
Controls whether or not the terminal will attempt to draw bold text by repainting text with a different offset.
terminal : |
a VteTerminal |
allow_bold : |
TRUE |
gboolean vte_terminal_get_allow_bold (VteTerminal *terminal);
Checks whether or not the terminal will attempt to draw bold text by repainting text with a one-pixel offset.
terminal : |
a VteTerminal |
Returns : | TRUE FALSE |
void vte_terminal_set_scroll_on_output (VteTerminal *terminal,
gboolean scroll);
Controls whether or not the terminal will forcibly scroll to the bottom of the viewable history when the new data is received from the child.
terminal : |
a VteTerminal |
scroll : |
TRUE |
void vte_terminal_set_scroll_on_keystroke
(VteTerminal *terminal,
gboolean scroll);
Controls whether or not the terminal will forcibly scroll to the bottom of the viewable history when the user presses a key. Modifier keys do not trigger this behavior.
terminal : |
a VteTerminal |
scroll : |
TRUE |
void vte_terminal_set_color_bold (VteTerminal *terminal,
constGdkColor *bold);
Sets the color used to draw bold text in the default foreground color.
terminal : |
a VteTerminal |
bold : |
the new bold color |
void vte_terminal_set_color_foreground (VteTerminal *terminal,
constGdkColor *foreground);
Sets the foreground color used to draw normal text
terminal : |
a VteTerminal |
foreground : |
the new foreground color |
void vte_terminal_set_color_background (VteTerminal *terminal,
constGdkColor *background);
Sets the background color for text which does not have a specific background color assigned. Only has effect when no background image is set and when the terminal is not transparent.
terminal : |
a VteTerminal |
background : |
the new background color |
void vte_terminal_set_color_dim (VteTerminal *terminal,
constGdkColor *dim);
Sets the color used to draw dim text in the default foreground color.
terminal : |
a VteTerminal |
dim : |
the new dim color |
void vte_terminal_set_color_cursor (VteTerminal *terminal,
constGdkColor *cursor_background);
Sets the background color for text which is under the cursor. If NULL
terminal : |
a VteTerminal |
cursor_background : |
the new color to use for the text cursor |
Since 0.11.11
void vte_terminal_set_color_highlight (VteTerminal *terminal,
constGdkColor *highlight_background);
Sets the background color for text which is highlighted. If NULL
terminal : |
a VteTerminal |
highlight_background : |
the new color to use for highlighted text |
Since 0.11.11
void vte_terminal_set_colors (VteTerminal *terminal,
constGdkColor *foreground,
constGdkColor *background,
constGdkColor *palette,
glong palette_size);
The terminal widget uses a 28-color model comprised of the default foreground and background colors, the bold foreground color, the dim foreground color, an eight color palette, bold versions of the eight color palette, and a dim version of the the eight color palette.
palette_size
must be either 0, 8, 16, or 24. If foreground
is NULL
palette_size
is greater than 0, the new foreground color is taken from
palette
[7]. If background
is NULL
palette_size
is greater than 0,
the new background color is taken from palette
[0]. If
palette_size
is 8 or 16, the third (dim) and possibly the second (bold)
8-color palettes are extrapolated from the new background color and the items
in palette
.
terminal : |
a VteTerminal |
foreground : |
the new foreground color, or NULL |
background : |
the new background color, or NULL |
palette : |
the color palette |
palette_size : |
the number of entries in palette
|
void vte_terminal_set_default_colors (VteTerminal *terminal);
Reset the terminal palette to reasonable compiled-in defaults.
terminal : |
a VteTerminal |
void vte_terminal_set_opacity (VteTerminal *terminal,
guint16 opacity);
Sets the opacity of the terminal background, were 0 means completely transparent and 65535 means completely opaque.
terminal : |
a VteTerminal |
opacity : |
the new opacity |
void vte_terminal_set_background_image (VteTerminal *terminal,
GdkPixbuf *image);
Sets a background image for the widget. Text which would otherwise be
drawn using the default background color will instead be drawn over the
specified image. If necessary, the image will be tiled to cover the
widget's entire visible area. If specified by
vte_terminal_set_background_saturation()
, the terminal will tint its
in-memory copy of the image before applying it to the terminal.
terminal : |
a VteTerminal |
image : |
a NULL |
void vte_terminal_set_background_image_file
(VteTerminal *terminal,
constchar *path);
Sets a background image for the widget. If specified by
vte_terminal_set_background_saturation()
, the terminal will tint its
in-memory copy of the image before applying it to the terminal.
terminal : |
a VteTerminal |
path : |
path to an image file |
void vte_terminal_set_background_saturation
(VteTerminal *terminal,
double saturation);
If a background image has been set using
vte_terminal_set_background_image()
,
vte_terminal_set_background_image_file()
, or
vte_terminal_set_background_transparent()
, and the saturation value is less
than 1.0, the terminal will adjust the colors of the image before drawing
the image. To do so, the terminal will create a copy of the background
image (or snapshot of the root window) and modify its pixel values.
terminal : |
a VteTerminal |
saturation : |
a floating point value between 0.0 and 1.0. |
void vte_terminal_set_background_transparent
(VteTerminal *terminal,
gboolean transparent);
Sets the terminal's background image to the pixmap stored in the root window, adjusted so that if there are no windows below your application, the widget will appear to be transparent.
terminal : |
a VteTerminal |
transparent : |
TRUE |
void vte_terminal_set_background_tint_color
(VteTerminal *terminal,
constGdkColor *color);
If a background image has been set using
vte_terminal_set_background_image()
,
vte_terminal_set_background_image_file()
, or
vte_terminal_set_background_transparent()
, and the value set by
vte_terminal_set_background_saturation()
is less than one, the terminal
will adjust the color of the image before drawing the image. To do so,
the terminal will create a copy of the background image (or snapshot of
the root window) and modify its pixel values. The initial tint color
is black.
terminal : |
a VteTerminal |
color : |
a color which the terminal background should be tinted to if its saturation is not 1.0. |
Since 0.11
void vte_terminal_set_scroll_background (VteTerminal *terminal,
gboolean scroll);
Controls whether or not the terminal will scroll the background image (if one is set) when the text in the window must be scrolled.
terminal : |
a VteTerminal |
scroll : |
TRUE |
Since 0.11
void vte_terminal_set_cursor_blinks (VteTerminal *terminal,
gboolean blink);
vte_terminal_set_cursor_blinks
is deprecated and should not be used in newly-written code. 0.16.15 Use vte_terminal_set_cursor_blink_mode()
instead.
Sets whether or not the cursor will blink.
terminal : |
a VteTerminal |
blink : |
TRUE |
VteTerminalCursorBlinkMode vte_terminal_get_cursor_blink_mode
(VteTerminal *terminal);
terminal : |
a VteTerminal |
Returns : | the cursor blink mode. |
Since 0.16.15