[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 16 07:57:14 UTC 2019


 vcl/unx/gtk3/gtk3gtkinst.cxx |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 76bcbdc67f1b22a45c90bfbfdff715465f403a66
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 15 20:25:28 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 16 09:56:34 2019 +0200

    swap left/right for RTL scrolling hadjustment
    
    Change-Id: Ia1cb82c5fce09c71f9378690a35355cb6636e6ae
    Reviewed-on: https://gerrit.libreoffice.org/80858
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 333f0e395f8b..3928e498ba35 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4997,18 +4997,39 @@ public:
                                        int page_size) override
     {
         disable_notify_events();
+        if (SwapForRTL())
+            value = upper - (value - lower + page_size);
         gtk_adjustment_configure(m_pHAdjustment, value, lower, upper, step_increment, page_increment, page_size);
         enable_notify_events();
     }
 
     virtual int hadjustment_get_value() const override
     {
-        return gtk_adjustment_get_value(m_pHAdjustment);
+        int value = gtk_adjustment_get_value(m_pHAdjustment);
+
+        if (SwapForRTL())
+        {
+            int upper = gtk_adjustment_get_upper(m_pHAdjustment);
+            int lower = gtk_adjustment_get_lower(m_pHAdjustment);
+            int page_size = gtk_adjustment_get_page_size(m_pHAdjustment);
+            value = lower + (upper - value - page_size);
+        }
+
+        return value;
     }
 
     virtual void hadjustment_set_value(int value) override
     {
         disable_notify_events();
+
+        if (SwapForRTL())
+        {
+            int upper = gtk_adjustment_get_upper(m_pHAdjustment);
+            int lower = gtk_adjustment_get_lower(m_pHAdjustment);
+            int page_size = gtk_adjustment_get_page_size(m_pHAdjustment);
+            value = upper - (value - lower + page_size);
+        }
+
         gtk_adjustment_set_value(m_pHAdjustment, value);
         enable_notify_events();
     }


More information about the Libreoffice-commits mailing list