[gtk+/treeview-refactor] Fix background area calculation in RTL mode



commit c01ad6f6155b76af90a288d02a8cef048c85b5a3
Author: Kristian Rietveld <kris gtk org>
Date:   Thu Dec 16 12:26:18 2010 +0100

    Fix background area calculation in RTL mode

 gtk/gtkcellareabox.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcellareabox.c b/gtk/gtkcellareabox.c
index 56a856b..e21bb0c 100644
--- a/gtk/gtkcellareabox.c
+++ b/gtk/gtkcellareabox.c
@@ -1148,13 +1148,29 @@ gtk_cell_area_box_foreach_alloc (GtkCellArea          *area,
 	{
 	  if (l == allocated_cells)
 	    {
-	      cell_background.width += cell_background.x - background_area->x;
-	      cell_background.x      = background_area->x;
+              /* Add the depth to the first cell */
+              if (rtl)
+                {
+                  cell_background.width += background_area->width - cell_area->width;
+                  cell_background.x      = background_area->x + background_area->width - cell_background.width;
+                }
+              else
+                {
+                  cell_background.width += cell_area->x - background_area->x;
+                  cell_background.x      = background_area->x;
+                }
 	    }
 
 	  if (l->next == NULL)
-	      cell_background.width = 
-		background_area->width - (cell_background.x - background_area->x);
+            {
+              /* Grant this cell the remaining space */
+              int remain = cell_background.x - background_area->x;
+
+              if (rtl)
+                cell_background.x -= remain;
+              else
+                cell_background.width = background_area->width - remain;
+            }
 
 	  cell_background.y      = background_area->y;
 	  cell_background.height = background_area->height;



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