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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 15 18:53:00 UTC 2019


 cui/source/options/dbregister.cxx |    2 +-
 vcl/unx/gtk3/gtk3gtkinst.cxx      |   36 ++++++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 7 deletions(-)

New commits:
commit 4a983f3b2ff9a9cbc593ae8a69e744f4bbf5df11
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 15 16:24:32 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Oct 15 20:51:54 2019 +0200

    honour per-widget RTL override
    
    Change-Id: I29a499d29a3c0fabc594efbd5f966b108659b166
    Reviewed-on: https://gerrit.libreoffice.org/80853
    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 f1de1bbfbacb..333f0e395f8b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1670,6 +1670,19 @@ static MouseEventModifiers ImplGetMouseMoveMode(sal_uInt16 nCode)
     return nMode;
 }
 
+namespace
+{
+    bool SwapForRTL(GtkWidget* pWidget)
+    {
+        GtkTextDirection eDir = gtk_widget_get_direction(pWidget);
+        if (eDir == GTK_TEXT_DIR_RTL)
+            return true;
+        if (eDir == GTK_TEXT_DIR_LTR)
+            return false;
+        return AllSettings::GetLayoutRTL();
+    }
+}
+
 class GtkInstanceWidget : public virtual weld::Widget
 {
 protected:
@@ -1812,6 +1825,16 @@ protected:
         return pThis->signal_popup_menu(aCEvt);
     }
 
+    bool SwapForRTL() const
+    {
+        GtkTextDirection eDir = gtk_widget_get_direction(m_pWidget);
+        if (eDir == GTK_TEXT_DIR_RTL)
+            return true;
+        if (eDir == GTK_TEXT_DIR_LTR)
+            return false;
+        return AllSettings::GetLayoutRTL();
+    }
+
 private:
     bool m_bTakeOwnership;
     bool m_bFrozen;
@@ -1922,7 +1945,8 @@ private:
         }
 
         Point aPos(pEvent->x, pEvent->y);
-        if (AllSettings::GetLayoutRTL())
+
+        if (SwapForRTL())
             aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
 
         if (gdk_event_triggers_context_menu(reinterpret_cast<GdkEvent*>(pEvent)) && pEvent->type == GDK_BUTTON_PRESS)
@@ -1962,7 +1986,7 @@ private:
             return false;
 
         Point aPos(pEvent->x, pEvent->y);
-        if (AllSettings::GetLayoutRTL())
+        if (SwapForRTL())
             aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
         sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
         sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
@@ -1985,7 +2009,7 @@ private:
             return false;
 
         Point aPos(pEvent->x, pEvent->y);
-        if (AllSettings::GetLayoutRTL())
+        if (SwapForRTL())
             aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
         sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
         sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
@@ -6575,7 +6599,7 @@ public:
         {
             GdkRectangle aRect{static_cast<int>(rRect.Left()), static_cast<int>(rRect.Top()),
                                static_cast<int>(rRect.GetWidth()), static_cast<int>(rRect.GetHeight())};
-            if (AllSettings::GetLayoutRTL())
+            if (SwapForRTL(pWidget))
                 aRect.x = gtk_widget_get_allocated_width(pWidget) - aRect.width - 1 - aRect.x;
 
             // Send a keyboard event through gtk_main_do_event to toggle any active tooltip offs
@@ -10168,7 +10192,7 @@ private:
         aGdkHelpArea.y = aHelpArea.Top();
         aGdkHelpArea.width = aHelpArea.GetWidth();
         aGdkHelpArea.height = aHelpArea.GetHeight();
-        if (AllSettings::GetLayoutRTL())
+        if (pThis->SwapForRTL())
             aGdkHelpArea.x = gtk_widget_get_allocated_width(pGtkWidget) - aGdkHelpArea.width - 1 - aGdkHelpArea.x;
         gtk_tooltip_set_tip_area(tooltip, &aGdkHelpArea);
         return true;
@@ -10181,7 +10205,7 @@ private:
     {
         SalWheelMouseEvent aEvt(GtkSalFrame::GetWheelEvent(*pEvent));
 
-        if (AllSettings::GetLayoutRTL())
+        if (SwapForRTL())
             aEvt.mnX = gtk_widget_get_allocated_width(m_pWidget) - 1 - aEvt.mnX;
 
         CommandWheelMode nMode;
commit 6cfbec5f561929e020b68f5a79738d38c0806cd4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 15 17:13:01 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Oct 15 20:51:41 2019 +0200

    database options page too tall
    
    Change-Id: I79ce30e2254980994e64764525efc307c1a79db1
    Reviewed-on: https://gerrit.libreoffice.org/80852
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 0cf15071adf8..171e3f869ecc 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -90,7 +90,7 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage(weld::Container* pPage, wel
     , m_xIter(m_xPathBox->make_iterator())
 {
     Size aControlSize(m_xPathBox->get_approximate_digit_width() * 60,
-                      m_xPathBox->get_height_rows(35));
+                      m_xPathBox->get_height_rows(12));
     m_xPathBox->set_size_request(aControlSize.Width(), aControlSize.Height());
 
     std::vector<int> aWidths;


More information about the Libreoffice-commits mailing list