Range: Use should_invert_move() to scroll value
authorDaniel Boles <dboles@src.gnome.org>
Mon, 1 Jan 2018 14:28:16 +0000 (14:28 +0000)
committerDaniel Boles <dboles.src@gmail.com>
Wed, 18 Apr 2018 17:36:55 +0000 (18:36 +0100)
This fixes RTL and/or :inverted Ranges responding to a horizontal scroll
by moving the value/slider button in the opposite direction... See prev.

https://bugzilla.gnome.org/show_bug.cgi?id=791802

gtk/gtkrange.c

index 29082d06e9f6e8560a74d9dcf49b4e26dba43cb0..f064a1d99fabdf46854149922d4fe963bf2d298b 100644 (file)
@@ -2246,6 +2246,7 @@ gtk_range_scroll_controller_scroll (GtkEventControllerScroll *scroll,
   GtkRangePrivate *priv = gtk_range_get_instance_private (range);
   gdouble scroll_unit, delta;
   gboolean handled;
+  GtkOrientation move_orientation;
 
 #ifdef GDK_WINDOWING_QUARTZ
   scroll_unit = 1;
@@ -2253,12 +2254,18 @@ gtk_range_scroll_controller_scroll (GtkEventControllerScroll *scroll,
   scroll_unit = gtk_adjustment_get_page_increment (priv->adjustment);
 #endif
 
-  if (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
-    delta = (dx ? dx : -dy) * scroll_unit;
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL && dx != 0)
+    {
+      move_orientation = GTK_ORIENTATION_HORIZONTAL;
+      delta = dx * scroll_unit;
+    }
   else
-    delta = dy * scroll_unit;
+    {
+      move_orientation = GTK_ORIENTATION_VERTICAL;
+      delta = dy * scroll_unit;
+    }
 
-  if (priv->inverted)
+  if (delta != 0 && should_invert_move (range, move_orientation))
     delta = - delta;
 
   g_signal_emit (range, signals[CHANGE_VALUE], 0,