Blob Blame History Raw
From 463c27c39549a3fbcc6a59e56822e47d0a4303e0 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 04be15324d3d..c5ae00a82064 100644
--- a/src/org.gnome.Terminal.gschema.xml
+++ b/src/org.gnome.Terminal.gschema.xml
@@ -427,6 +427,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 240213fead43..7e9fc96cad9f 100644
--- a/src/terminal-schemas.h
+++ b/src/terminal-schemas.h
@@ -77,6 +77,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 faf906c763e7..18cb3318308d 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1016,6 +1016,15 @@ terminal_screen_profile_changed_cb (GSettings     *profile,
   if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY))
     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.14.4


From bc6e7ef2477ace9e81e48c001bd3e65bec618282 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Fri, 8 Jun 2018 17:08:01 +0200
Subject: [PATCH 2/2] profile: Expose the scroll speed setting in the UI

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

diff --git a/src/preferences.ui b/src/preferences.ui
index 0dddd9bf32ba..6932f845e33a 100644
--- a/src/preferences.ui
+++ b/src/preferences.ui
@@ -82,6 +82,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 -->
@@ -1841,6 +1847,60 @@
                                 <property name="left_attach">1</property>
                               </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="top_attach">4</property>
+                                <property name="left_attach">0</property>
+                              </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>
+                                <property name="hexpand">True</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="top_attach">4</property>
+                                <property name="left_attach">1</property>
+                              </packing>
+                            </child>
                           </object>
                           <packing>
                             <property name="position">2</property>
diff --git a/src/profile-editor.c b/src/profile-editor.c
index 0b8f2b6951a7..889372adb35b 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -1355,6 +1355,23 @@ profile_prefs_load (const char *uuid, GSettings *profile)
                                gtk_builder_get_object (builder, "background-transparent-adjustment"),
                                "value",
                                G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+
+  profile_prefs_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);
+  profile_prefs_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);
+  profile_prefs_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);
 }
 
 /* Called once per Preferences window, to destroy stuff that doesn't depend on the profile being edited */
-- 
2.14.4