summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-08-20 18:26:28 +0000
committerMatthias Clasen <mclasen@redhat.com>2018-08-20 18:26:28 +0000
commit3e4d7250a005b799a4b7500f84dbabf3ec758750 (patch)
tree0cf23da9468347a9e67c93279f3780f6f9f7b242
parent4ebd14c0456d0442d4ee68d51383b2991e7efcc6 (diff)
parent14b21d78db1c236ebf958fcc8fa4446ac2bb1149 (diff)
downloadgtk+-3e4d7250a005b799a4b7500f84dbabf3ec758750.tar.gz
Merge branch 'fix-shifted-scrolling' into 'master'
gtkscrolledwindow: Consider shift key presses when decelerating Closes #770 See merge request GNOME/gtk!286
-rw-r--r--gtk/gtkscrolledwindow.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 90d7b2fdfe..68e048c929 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1341,12 +1341,29 @@ scroll_controller_decelerate (GtkEventControllerScroll *scroll,
GtkScrolledWindow *scrolled_window)
{
gdouble unit_x, unit_y;
+ gboolean shifted;
+ GdkModifierType state;
+
+ if (!gtk_get_current_event_state (&state))
+ return;
+
+ shifted = (state & GDK_SHIFT_MASK) != 0;
unit_x = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL);
unit_y = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL);
- gtk_scrolled_window_decelerate (scrolled_window,
- initial_vel_x * unit_x,
- initial_vel_y * unit_y);
+
+ if (shifted)
+ {
+ gtk_scrolled_window_decelerate (scrolled_window,
+ initial_vel_y * unit_x,
+ initial_vel_x * unit_y);
+ }
+ else
+ {
+ gtk_scrolled_window_decelerate (scrolled_window,
+ initial_vel_x * unit_x,
+ initial_vel_y * unit_y);
+ }
}
static void