[vte/vte-next] Make 'scroll-background' a style property



commit 692a3291c68d0e93c0f1d715663d8a82a39e8f20
Author: Christian Persch <chpe gnome org>
Date:   Tue May 17 21:52:40 2011 +0200

    Make 'scroll-background' a style property

 src/vte.c    |   79 +++++++++++++++++----------------------------------------
 src/vte.h    |    1 -
 src/vteapp.c |    4 ++-
 3 files changed, 27 insertions(+), 57 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index 52c4cfd..08ca9c2 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -148,7 +148,6 @@ enum {
         PROP_ICON_TITLE,
         PROP_MOUSE_POINTER_AUTOHIDE,
         PROP_PTY_OBJECT,
-        PROP_SCROLL_BACKGROUND,
         PROP_SCROLLBACK_LINES,
         PROP_SCROLL_ON_KEYSTROKE,
         PROP_SCROLL_ON_OUTPUT,
@@ -4238,7 +4237,7 @@ vte_terminal_update_style(VteTerminal *terminal)
         VteTerminalPrivate *pvt = terminal->pvt;
         GtkWidget *widget = &terminal->widget;
         float aspect;
-        gboolean allow_bold;
+        gboolean allow_bold, scroll_background;
         int cursor_shape;
 
         vte_terminal_set_font(terminal, pvt->fontdesc);
@@ -4248,6 +4247,7 @@ vte_terminal_update_style(VteTerminal *terminal)
                              "allow-bold", &allow_bold,
                              "cursor-shape", &cursor_shape,
                              "cursor-aspect-ratio", &aspect,
+                             "scroll-background", &scroll_background,
                              NULL);
 
         if (allow_bold != pvt->allow_bold) {
@@ -4264,6 +4264,11 @@ vte_terminal_update_style(VteTerminal *terminal)
                 pvt->cursor_aspect_ratio = aspect;
                 _vte_invalidate_cursor_once(terminal, FALSE);
         }
+
+        if (scroll_background != pvt->scroll_background) {
+                  pvt->scroll_background = scroll_background;
+                  vte_terminal_queue_background_update(terminal);
+        }
 }
 
 static void
@@ -7637,6 +7642,7 @@ vte_terminal_init(VteTerminal *terminal)
 	pvt->pty_pid = -1;
 
 	/* Scrolling options. */
+        pvt->scroll_background = FALSE;
 	pvt->scroll_on_keystroke = TRUE;
         pvt->scrollback_lines = -1; /* force update in vte_terminal_set_scrollback_lines */
 	vte_terminal_set_scrollback_lines(terminal, VTE_SCROLLBACK_INIT);
@@ -10603,9 +10609,6 @@ vte_terminal_get_property (GObject *object,
                 case PROP_PTY_OBJECT:
                         g_value_set_object (value, vte_terminal_get_pty_object(terminal));
                         break;
-                case PROP_SCROLL_BACKGROUND:
-                        g_value_set_boolean (value, pvt->scroll_background);
-                        break;
                 case PROP_SCROLLBACK_LINES:
                         g_value_set_uint (value, pvt->scrollback_lines);
                         break;
@@ -10686,9 +10689,6 @@ vte_terminal_set_property (GObject *object,
                 case PROP_PTY_OBJECT:
                         vte_terminal_set_pty_object (terminal, g_value_get_object (value));
                         break;
-                case PROP_SCROLL_BACKGROUND:
-                        vte_terminal_set_scroll_background (terminal, g_value_get_boolean (value));
-                        break;
                 case PROP_SCROLLBACK_LINES:
                         vte_terminal_set_scrollback_lines (terminal, g_value_get_uint (value));
                         break;
@@ -11486,21 +11486,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                       G_PARAM_STATIC_STRINGS));
 
         /**
-         * VteTerminal:scroll-background:
-         *
-         * Controls whether or not the terminal will scroll the background image (if
-         * one is set) when the text in the window must be scrolled.
-         * 
-         * Since: 0.20
-         */
-        g_object_class_install_property
-                (gobject_class,
-                 PROP_SCROLL_BACKGROUND,
-                 g_param_spec_boolean ("scroll-background", NULL, NULL,
-                                       FALSE,
-                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-     
-        /**
          * VteTerminal:scrollback-lines:
          *
          * The length of the scrollback buffer used by the terminal.  The size of
@@ -11632,6 +11617,20 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                     VTE_CURSOR_SHAPE_BLOCK,
                                     G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+        /**
+         * VteTerminal:scroll-background:
+         *
+         * Controls whether or not the terminal will scroll the background image (if
+         * one is set) when the text in the window must be scrolled.
+         *
+         * Since: 0.30
+         */
+        gtk_widget_class_install_style_property
+                (widget_class,
+                 g_param_spec_boolean ("scroll-background", NULL, NULL,
+                                       FALSE,
+                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
         /* Keybindings */
 	binding_set = gtk_binding_set_by_class(klass);
 
@@ -11650,7 +11649,8 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                            "padding: 1 1 1 1;\n"
                                            "-VteTerminal-allow-bold: true;\n"
                                            "-VteTerminal-cursor-shape: block;\n"
-                                         "}\n",
+                                           "-VteTerminal-scroll-background: false;\n"
+                                           "}\n",
                                          -1, NULL);
 }
 
@@ -11742,37 +11742,6 @@ vte_terminal_get_visible_bell(VteTerminal *terminal)
 }
 
 /**
- * vte_terminal_set_scroll_background:
- * @terminal: a #VteTerminal
- * @scroll: whether the terminal should scroll the background image along with
- *   the text
- *
- * Controls whether or not the terminal will scroll the background image (if
- * one is set) when the text in the window must be scrolled.
- *
- * Since: 0.11
- */
-void
-vte_terminal_set_scroll_background(VteTerminal *terminal, gboolean scroll)
-{
-        VteTerminalPrivate *pvt;
-
-	g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-        pvt = terminal->pvt;
-
-        scroll = scroll != FALSE;
-        if (scroll == pvt->scroll_background)
-                return;
-
-	pvt->scroll_background = scroll;
-
-        g_object_notify (G_OBJECT (terminal), "scroll-background");
-
-        vte_terminal_queue_background_update(terminal);
-}
-
-/**
  * vte_terminal_set_scroll_on_output:
  * @terminal: a #VteTerminal
  * @scroll: whether the terminal should scroll on output
diff --git a/src/vte.h b/src/vte.h
index 7d8d970..e92ef67 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -222,7 +222,6 @@ 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_scroll_background(VteTerminal *terminal, gboolean scroll);
 void vte_terminal_set_scroll_on_output(VteTerminal *terminal, gboolean scroll);
 void vte_terminal_set_scroll_on_keystroke(VteTerminal *terminal,
 					  gboolean scroll);
diff --git a/src/vteapp.c b/src/vteapp.c
index e447791..85b130e 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -797,6 +797,9 @@ main(int argc, char **argv)
                                         cursor_shape_string);
                 g_free(cursor_shape_string);
         }
+        if (scroll) {
+                g_string_append (css_string, "VteTerminal { -VteTerminal-scroll-background: true; }\n");
+        }
 
 	if (!reverse) {
 		back.red = back.green = back.blue = 1.0; back.alpha = 1.0;
@@ -918,7 +921,6 @@ main(int argc, char **argv)
 	vte_terminal_set_audible_bell(terminal, audible);
 	vte_terminal_set_visible_bell(terminal, !audible);
 	vte_terminal_set_cursor_blink_mode(terminal, cursor_blink_mode);
-	vte_terminal_set_scroll_background(terminal, scroll);
 	vte_terminal_set_scroll_on_output(terminal, FALSE);
 	vte_terminal_set_scroll_on_keystroke(terminal, TRUE);
 	vte_terminal_set_scrollback_lines(terminal, lines);



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