[gtk/wip/otte/bitset: 95/99] listbase: Flip autoscroll deltas if adjustments are flipped



commit 3bdd6e284e6cc177dd032ed350f6dc19ca8dfe5a
Author: Benjamin Otte <otte redhat com>
Date:   Wed Jun 24 05:52:35 2020 +0200

    listbase: Flip autoscroll deltas if adjustments are flipped
    
    Fixes autoscroll on RTL languages.

 gtk/gtklistbase.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c
index 05df60b30f..7c4af31cb7 100644
--- a/gtk/gtklistbase.c
+++ b/gtk/gtklistbase.c
@@ -1275,8 +1275,14 @@ add_autoscroll (GtkListBase *self,
 {
   GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
 
-  priv->autoscroll_delta_x = delta_x;
-  priv->autoscroll_delta_y = delta_y;
+  if (gtk_list_base_adjustment_is_flipped (self, GTK_ORIENTATION_HORIZONTAL))
+    priv->autoscroll_delta_x = -delta_x;
+  else
+    priv->autoscroll_delta_x = delta_x;
+  if (gtk_list_base_adjustment_is_flipped (self, GTK_ORIENTATION_VERTICAL))
+    priv->autoscroll_delta_y = -delta_y;
+  else
+    priv->autoscroll_delta_y = delta_y;
 
   if (priv->autoscroll_id == 0)
     priv->autoscroll_id = gtk_widget_add_tick_callback (GTK_WIDGET (self), autoscroll_cb, self, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]