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



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

    Make 'scroll-background' a style property

 doc/reference/vte-sections.txt |    1 -
 src/vte.c                      |   79 ++++++++++++----------------------------
 src/vte.h                      |    1 -
 src/vteapp.c                   |    4 ++-
 4 files changed, 27 insertions(+), 58 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 19830b5..c3ffd5c 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -35,7 +35,6 @@ vte_terminal_set_colors_rgba
 vte_terminal_set_default_colors
 vte_terminal_get_background_pattern
 vte_terminal_set_background_pattern
-vte_terminal_set_scroll_background
 vte_terminal_get_cursor_blink_mode
 vte_terminal_set_cursor_blink_mode
 vte_terminal_set_scrollback_lines
diff --git a/src/vte.c b/src/vte.c
index b412dae..2c1f6c3 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,
@@ -4236,7 +4235,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);
@@ -4246,6 +4245,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) {
@@ -4262,6 +4262,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
@@ -7635,6 +7640,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);
@@ -10601,9 +10607,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;
@@ -10684,9 +10687,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;
@@ -11484,21 +11484,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
@@ -11630,6 +11615,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);
 
@@ -11648,7 +11647,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);
 }
 
@@ -11740,37 +11740,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 4d96bda..596d228 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -802,6 +802,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;
@@ -923,7 +926,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]