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

Khaled Hosny khaledhosny at eglug.org
Sun Aug 23 13:00:19 PDT 2015


 vcl/source/gdi/salgdilayout.cxx               |    4 ++-
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   29 +++++++++++++++++++-------
 2 files changed, 25 insertions(+), 8 deletions(-)

New commits:
commit e2582341af9f6b756e5d95c8ddd99652b62d1a41
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon Aug 17 04:00:49 2015 +0200

    Fix GTK3 right-to-left rendering of spin buttons
    
    The button were not drawn at all
    
    Change-Id: I51dfa30a6daa1034b5e978b09bcdfcc83e859f3d
    Reviewed-on: https://gerrit.libreoffice.org/17790
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 8ee0d0a..7344423 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -139,25 +139,40 @@ Rectangle GtkSalGraphics::NWGetSpinButtonRect( ControlPart nPart, Rectangle aAre
     buttonRect.SetSize(Size(buttonWidth, buttonHeight));
     buttonRect.setY(aAreaRect.Top());
     buttonRect.Bottom() = buttonRect.Top() + aAreaRect.GetHeight();
+    Rectangle partRect(buttonRect);
     if ( nPart == PART_BUTTON_UP )
     {
-        buttonRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - buttonRect.GetWidth()));
+        if (AllSettings::GetLayoutRTL())
+            partRect.setX(aAreaRect.Left());
+        else
+            partRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - buttonRect.GetWidth()));
     }
     else if( nPart == PART_BUTTON_DOWN )
     {
-        buttonRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - 2*buttonRect.GetWidth()));
+        if (AllSettings::GetLayoutRTL())
+            partRect.setX(aAreaRect.Left() + buttonRect.GetWidth());
+        else
+            partRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - 2 * buttonRect.GetWidth()));
     }
     else
     {
-        buttonRect.Right() = (aAreaRect.Left() + (aAreaRect.GetWidth() - 2*buttonRect.GetWidth()))-1;
-        buttonRect.Left()   = aAreaRect.Left();
-        buttonRect.Top()    = aAreaRect.Top();
-        buttonRect.Bottom() = aAreaRect.Bottom();
+        if (AllSettings::GetLayoutRTL())
+        {
+            partRect.Right() = aAreaRect.Left() + aAreaRect.GetWidth();
+            partRect.Left()  = aAreaRect.Left() + (2 * buttonRect.GetWidth()) - 1;
+        }
+        else
+        {
+            partRect.Right() = (aAreaRect.Left() + (aAreaRect.GetWidth() - 2 * buttonRect.GetWidth())) - 1;
+            partRect.Left()  = aAreaRect.Left();
+        }
+        partRect.Top()    = aAreaRect.Top();
+        partRect.Bottom() = aAreaRect.Bottom();
     }
 
     gtk_style_context_restore(mpSpinStyle);
 
-    return buttonRect;
+    return partRect;
 }
 
 Rectangle GtkSalGraphics::NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect )
commit fff3c9d6e56ae380437333f9c15ff63742904f25
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Aug 23 20:46:53 2015 +0100

    don't mirror 0, RECT_EMPTY, 0, RECT_EMPTY rectangle
    
    leave it untouched to make gtk3 rtl spin buttons possible
    where the additional mirrorValue contains the region
    of the spinbuttons to render within this rectangle
    
    Change-Id: I2648d98ed36373c95947cc4d78e2e54797f01155
    Reviewed-on: https://gerrit.libreoffice.org/17940
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 2771c9d6..df124a9 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -703,7 +703,9 @@ bool SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const
     if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) )
     {
         Rectangle rgn( rControlRegion );
-        mirror( rgn, pOutDev );
+        Rectangle aNull;
+        if (rgn != aNull)
+            mirror(rgn, pOutDev);
         std::unique_ptr< ImplControlValue > mirrorValue( aValue.clone());
         mirror( *mirrorValue, pOutDev );
         bool bRet = drawNativeControl( nType, nPart, rgn, nState, *mirrorValue, aCaption );


More information about the Libreoffice-commits mailing list