[Xfce4-commits] [apps/xfce4-terminal] 01/01: Return ability of one-line scroll with Shift+Up/Down
noreply at xfce.org
noreply at xfce.org
Thu Oct 20 13:53:29 CEST 2016
This is an automated email from the git hooks/post-receive script.
f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.
commit 16c47b9eccb3095f893675ba84f6ceeed816252e
Author: Igor <f2404 at yandex.ru>
Date: Thu Oct 20 14:52:10 2016 +0300
Return ability of one-line scroll with Shift+Up/Down
But, it is turned off be default. Can be turned on with a hidden option
MiscUseShiftArrowsToScroll.
---
terminal/terminal-preferences.c | 11 +++++++++++
terminal/terminal-widget.c | 20 ++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 67c1baf..d6c70ae 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -95,6 +95,7 @@ enum
PROP_MISC_MIDDLE_CLICK_OPENS_URI,
PROP_MISC_DEFAULT_WORKING_DIR,
PROP_MISC_REWRAP_ON_RESIZE,
+ PROP_MISC_SHIFT_ARROWS_SCROLL,
PROP_SCROLLING_BAR,
PROP_SCROLLING_LINES,
PROP_SCROLLING_ON_OUTPUT,
@@ -855,6 +856,16 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
+ * TerminalPreferences:misc-shift-arrows-scroll:
+ **/
+ preferences_props[PROP_MISC_SHIFT_ARROWS_SCROLL] =
+ g_param_spec_boolean ("misc-shift-arrows-scroll",
+ NULL,
+ "MiscUseShiftArrowsToScroll",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+ /**
* TerminalPreferences:scrolling-bar:
**/
preferences_props[PROP_SCROLLING_BAR] =
diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c
index c8b9f2b..e5ff96b 100644
--- a/terminal/terminal-widget.c
+++ b/terminal/terminal-widget.c
@@ -596,11 +596,15 @@ static gboolean
terminal_widget_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
+ GtkAdjustment *adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget));
gboolean shortcuts_no_menukey;
+ gboolean shift_arrows_scroll;
+ gdouble value;
/* determine current settings */
g_object_get (G_OBJECT (TERMINAL_WIDGET (widget)->preferences),
"shortcuts-no-menukey", &shortcuts_no_menukey,
+ "misc-shift-arrows-scroll", &shift_arrows_scroll,
NULL);
/* popup context menu if "Menu" or "<Shift>F10" is pressed */
@@ -610,6 +614,22 @@ terminal_widget_key_press_event (GtkWidget *widget,
terminal_widget_context_menu (TERMINAL_WIDGET (widget), 0, event->time, (GdkEvent *) event);
return TRUE;
}
+ else if (G_UNLIKELY (shift_arrows_scroll))
+ {
+ /* scroll up one line with "<Shift>Up" */
+ if ((event->state & GDK_SHIFT_MASK) != 0 && (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up))
+ {
+ gtk_adjustment_set_value (adjustment, gtk_adjustment_get_value (adjustment) - 1);
+ return TRUE;
+ }
+ /* scroll down one line with "<Shift>Down" */
+ else if ((event->state & GDK_SHIFT_MASK) != 0 && (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_KP_Down))
+ {
+ value = MIN (gtk_adjustment_get_value (adjustment) + 1, gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_page_size (adjustment));
+ gtk_adjustment_set_value (adjustment, value);
+ return TRUE;
+ }
+ }
return (*GTK_WIDGET_CLASS (terminal_widget_parent_class)->key_press_event) (widget, event);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list