Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi all,

Here is a little patch that fixes a rendering buglet that annoyed me
since ever. Native GTK applications swap the position of the button and
editing area of comboboxes in RTL and themese expect that, but LO does
not.

The same issue happens with spin buttons and other similar widget, I'm
just making sure I'm doing it right before sending other patches.

Also I'm not sure how GTK3 relates to this (is it affected/need to be
fixed separately etc.) since I can't build with it here.

BTW, Application::GetSettings().GetLayoutRTL() is now used in several
places (and may be more will come), would it be more rideable/save a few
microsocends to have a 

bool isLayoutRTL = Application::GetSettings().GetLayoutRTL()

(or something like that) on the top of the file?

Regards,
 Khaled
From a8fd7c4a5dbf57003339af883ae795eefe093f90 Mon Sep 17 00:00:00 2001
From: Khaled Hosny <khaledhosny@eglug.org>
Date: Wed, 30 Nov 2011 08:57:46 +0200
Subject: [PATCH] gtk: fix RTL combobox rendering

GTK themes expect the button and the editing area to be swapped in RTL.
---
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 2cdd032..6afba20 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -2185,6 +2185,8 @@ sal_Bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
 
     Rectangle        aEditBoxRect( pixmapRect );
     aEditBoxRect.SetSize( Size( pixmapRect.GetWidth() - buttonRect.GetWidth(), 
aEditBoxRect.GetHeight() ) );
+    if( Application::GetSettings().GetLayoutRTL() )
+        aEditBoxRect.SetPos( Point( x + buttonRect.GetWidth() , y ) );
 
     #define ARROW_EXTENT        0.7
     arrowRect.SetSize( Size( (gint)(MIN_ARROW_SIZE * ARROW_EXTENT),
@@ -2254,8 +2256,11 @@ static Rectangle NWGetComboBoxButtonRect( int nScreen,
     if( nPart == PART_BUTTON_DOWN )
     {
         aButtonRect.SetSize( Size( nButtonWidth, aAreaRect.GetHeight() ) );
-        aButtonRect.SetPos( Point( aAreaRect.Left() + aAreaRect.GetWidth() - nButtonWidth,
-                                   aAreaRect.Top() ) );
+        if( Application::GetSettings().GetLayoutRTL() )
+            aButtonRect.SetPos( Point( aAreaRect.Left(), aAreaRect.Top() ) );
+        else
+            aButtonRect.SetPos( Point( aAreaRect.Left() + aAreaRect.GetWidth() - nButtonWidth,
+                                       aAreaRect.Top() ) );
     }
     else if( nPart == PART_SUB_EDIT )
     {
@@ -2271,6 +2276,8 @@ static Rectangle NWGetComboBoxButtonRect( int nScreen,
         Point aEditPos = aAreaRect.TopLeft();
         aEditPos.X() += adjust_x;
         aEditPos.Y() += adjust_y;
+        if( Application::GetSettings().GetLayoutRTL() )
+            aEditPos.X() += nButtonWidth;
         aButtonRect.SetPos( aEditPos );
     }
 
-- 
1.7.0.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.