summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2009-11-30 23:06:01 +0100
committerChristian Persch <chpe@gnome.org>2009-12-01 15:35:00 +0100
commita327292cbb073e7fb1a1298f614f980447f474fe (patch)
tree12aef1674190e161b697b2cc35917ee2842d0eb2
parent320902d84b99c58ab7d6ae82b65bb1311288fe75 (diff)
Add VteTerminal::inner-border style property
Part of bug #471920.
-rw-r--r--doc/reference/tmpl/vte.sgml5
-rw-r--r--src/vte-private.h3
-rw-r--r--src/vte.c51
3 files changed, 58 insertions, 1 deletions
diff --git a/doc/reference/tmpl/vte.sgml b/doc/reference/tmpl/vte.sgml
index 8a3cc31..a7b98a0 100644
--- a/doc/reference/tmpl/vte.sgml
+++ b/doc/reference/tmpl/vte.sgml
@@ -386,6 +386,11 @@ All of these fields should be considered read-only.
</para>
+<!-- ##### ARG VteTerminal:inner-border ##### -->
+<para>
+
+</para>
+
<!-- ##### ENUM VteTerminalEraseBinding ##### -->
<para>
An enumerated type which can be used to indicate which string the terminal
diff --git a/src/vte-private.h b/src/vte-private.h
index 7513d12..044aed3 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -382,6 +382,9 @@ struct _VteTerminalPrivate {
glong line_thickness;
glong underline_position;
glong strikethrough_position;
+
+ /* Style stuff */
+ GtkBorder inner_border;
};
diff --git a/src/vte.c b/src/vte.c
index 3c8ed6b..cc39ce2 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -167,6 +167,8 @@ static gboolean in_update_timeout;
static GList *active_terminals;
static GTimer *process_timer;
+static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
+
/* process incoming data without copying */
static struct _vte_incoming_chunk *free_chunks;
static struct _vte_incoming_chunk *
@@ -4567,6 +4569,31 @@ vte_terminal_hierarchy_changed(GtkWidget *widget, GtkWidget *old_toplevel,
}
static void
+vte_terminal_set_inner_border(VteTerminal *terminal)
+{
+ VteTerminalPrivate *pvt = terminal->pvt;
+ GtkWidget *widget = GTK_WIDGET(terminal);
+ GtkBorder *border = NULL;
+ GtkBorder inner_border;
+
+ gtk_widget_style_get(widget, "inner-border", &border, NULL);
+
+ if (border != NULL) {
+ inner_border = *border;
+ gtk_border_free(border);
+ } else {
+ inner_border = default_inner_border;
+ }
+
+ if (memcmp(&inner_border, &pvt->inner_border, sizeof(GtkBorder)) == 0)
+ return;
+
+ pvt->inner_border = inner_border;
+
+ gtk_widget_queue_resize(widget);
+}
+
+static void
vte_terminal_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
@@ -4574,9 +4601,13 @@ vte_terminal_style_set (GtkWidget *widget,
GTK_WIDGET_CLASS (vte_terminal_parent_class)->style_set (widget, prev_style);
+ if (gtk_widget_get_style(widget) == prev_style)
+ return;
+
vte_terminal_set_font_full_internal(terminal, terminal->pvt->fontdesc,
terminal->pvt->fontantialias);
+ vte_terminal_set_inner_border(terminal);
}
static void
@@ -7970,6 +8001,8 @@ vte_terminal_init(VteTerminal *terminal)
G_CALLBACK(vte_terminal_hierarchy_changed),
NULL);
+ pvt->inner_border = default_inner_border;
+
#ifdef VTE_DEBUG
/* In debuggable mode, we always do this. */
/* gtk_widget_get_accessible(&terminal->widget); */
@@ -12117,7 +12150,23 @@ vte_terminal_class_init(VteTerminalClass *klass)
g_param_spec_boolean ("visible-bell", NULL, NULL,
FALSE,
G_PARAM_READWRITE | STATIC_PARAMS));
-
+
+ /* Style properties */
+
+ /**
+ * VteTerminal:inner-border:
+ *
+ * Sets the border around the terminal.
+ *
+ * Since: 0.22
+ */
+ gtk_widget_class_install_style_property
+ (widget_class,
+ g_param_spec_boxed ("inner-border", NULL, NULL,
+ GTK_TYPE_BORDER,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
/* Keybindings */
binding_set = gtk_binding_set_by_class(klass);