Blob Blame History Raw
From 8087ce330eae46e35ea4973215631f2789712247 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Fri, 13 May 2016 19:43:29 +0200
Subject: [PATCH 1/2] schemas: screen: Add a setting to configure the scroll
 speed

https://bugzilla.redhat.com/show_bug.cgi?id=1103380
---
 src/org.gnome.Terminal.gschema.xml | 11 +++++++++++
 src/terminal-schemas.h             |  2 ++
 src/terminal-screen.c              |  9 +++++++++
 3 files changed, 22 insertions(+)

diff --git a/src/org.gnome.Terminal.gschema.xml b/src/org.gnome.Terminal.gschema.xml
index 14cfacdb40cb..3606e1dac98a 100644
--- a/src/org.gnome.Terminal.gschema.xml
+++ b/src/org.gnome.Terminal.gschema.xml
@@ -397,6 +397,17 @@
       <summary>Adjust the amount of transparency</summary>
       <description>A value between 0 and 100, where 0 is opaque and 100 is fully transparent.</description>
     </key>
+    <key name="scroll-speed-auto" type="b">
+      <default>true</default>
+      <summary>Whether to use a dynamic scrolling speed</summary>
+      <description>If true, the speed will be a function of the number of visible rows. Otherwise, the buffer will scroll by a fixed number of lines regardless of the number of visible rows.</description>
+    </key>
+    <key name="scroll-speed" type="u">
+      <default>1</default>
+      <range min="1" max="10"/>
+      <summary>Adjust the scrolling speed</summary>
+      <description>The number of lines by which the buffer is moved when scrolling with a mouse wheel on top of the terminal.</description>
+    </key>
   </schema>
 
   <!-- Keybinding settings -->
diff --git a/src/terminal-schemas.h b/src/terminal-schemas.h
index a6d2a92ee816..2338f93ded95 100644
--- a/src/terminal-schemas.h
+++ b/src/terminal-schemas.h
@@ -73,6 +73,8 @@ G_BEGIN_DECLS
 
 #define TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND      "use-transparent-background"
 #define TERMINAL_PROFILE_BACKGROUND_TRANSPARENCY_PERCENT "background-transparency-percent"
+#define TERMINAL_PROFILE_SCROLL_SPEED_KEY                "scroll-speed"
+#define TERMINAL_PROFILE_SCROLL_SPEED_AUTO_KEY           "scroll-speed-auto"
 
 #define TERMINAL_SETTING_CONFIRM_CLOSE_KEY              "confirm-close"
 #define TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR_KEY       "default-show-menubar"
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index ae7b07bc0e9a..2857ea1fdd2c 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1011,6 +1011,15 @@ terminal_screen_profile_changed_cb (GSettings     *profile,
     vte_terminal_set_scroll_on_output (vte_terminal,
                                        g_settings_get_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY));
   if (!prop_name ||
+      prop_name == I_(TERMINAL_PROFILE_SCROLL_SPEED_KEY) ||
+      prop_name == I_(TERMINAL_PROFILE_SCROLL_SPEED_AUTO_KEY))
+    {
+      guint scroll_speed = g_settings_get_boolean (profile, TERMINAL_PROFILE_SCROLL_SPEED_AUTO_KEY) ?
+                           0 : g_settings_get_uint (profile, TERMINAL_PROFILE_SCROLL_SPEED_KEY);
+      vte_terminal_set_scroll_speed (vte_terminal, scroll_speed);
+    }
+
+  if (!prop_name ||
       prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES_KEY) ||
       prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY))
     {
-- 
2.9.3


From 6980bbb9eea5e2859dae40d131d0e74a9904714d Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Fri, 13 May 2016 19:45:03 +0200
Subject: [PATCH 2/2] profile: Expose the scroll speed setting in the UI

https://bugzilla.redhat.com/show_bug.cgi?id=1103380
---
 src/profile-editor.c       | 17 ++++++++++++
 src/profile-preferences.ui | 67 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)

diff --git a/src/profile-editor.c b/src/profile-editor.c
index a240a37d7573..e1052e9e012d 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -1236,6 +1236,23 @@ terminal_profile_edit (GSettings  *profile,
                    gtk_builder_get_object (builder, "background-transparent-adjustment"),
                    "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
 
+  g_settings_bind (profile, TERMINAL_PROFILE_SCROLL_SPEED_AUTO_KEY,
+                   gtk_builder_get_object (builder,
+                                           "scrollspeed-static-checkbutton"),
+                   "active",
+                   G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET |
+                   G_SETTINGS_BIND_INVERT_BOOLEAN);
+  g_settings_bind (profile, TERMINAL_PROFILE_SCROLL_SPEED_AUTO_KEY,
+                   gtk_builder_get_object (builder,
+                                           "scrollspeed-box"),
+                   "sensitive",
+                   G_SETTINGS_BIND_GET |
+                   G_SETTINGS_BIND_INVERT_BOOLEAN |
+                   G_SETTINGS_BIND_NO_SENSITIVITY);
+  g_settings_bind (profile, TERMINAL_PROFILE_SCROLL_SPEED_KEY,
+                   gtk_builder_get_object (builder, "scroll-speed-adjustment"),
+                   "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+
   /* Finished! */
 
   terminal_util_bind_mnemonic_label_sensitivity (editor);
diff --git a/src/profile-preferences.ui b/src/profile-preferences.ui
index e16ee4332e99..906770d9a9bf 100644
--- a/src/profile-preferences.ui
+++ b/src/profile-preferences.ui
@@ -28,6 +28,12 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="scroll-speed-adjustment">
+    <property name="lower">1</property>
+    <property name="upper">10</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">5</property>
+  </object>
   <object class="GtkListStore" id="cjk-ambiguous-width-model">
     <columns>
       <!-- column-name gchararray -->
@@ -1762,6 +1768,67 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkCheckButton" id="scrollspeed-static-checkbutton">
+                    <property name="label" translatable="yes">_Fix scroll speed to:</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="right_attach">1</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+                    <property name="y_options"/>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="scrollspeed-box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkSpinButton" id="scroll-speed-spinbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="adjustment">scroll-speed-adjustment</property>
+                        <property name="climb_rate">1</property>
+                        <property name="numeric">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="scroll-speed-spinbutton-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">lines</property>
+                        <property name="justify">center</property>
+                        <property name="mnemonic_widget">scroll-speed-spinbutton</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="x_options">GTK_EXPAND | GTK_FILL</property>
+                    <property name="y_options"/>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkCheckButton" id="scrollbar-checkbutton">
                     <property name="label" translatable="yes">_Show scrollbar</property>
                     <property name="visible">True</property>
-- 
2.9.3