Range: Use should_invert_move() to scroll value

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
This commit is contained in:
Daniel Boles
2018-01-01 14:28:16 +00:00
committed by Daniel Boles
parent bc2a38a59e
commit 6985dde320

View 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,