[Xfce4-commits] [apps/xfdashboard] 01/01: Fix a division by zero bug when calculating x and y coordinates of each cell in _xfdashboard_dynamic_table_layout_update_layout_data() and correct allocation of container to get scroll bars visible if neccessary (the allocation of container was not set at all and that was the bug).

noreply at xfce.org noreply at xfce.org
Thu Jan 28 14:55:41 CET 2016


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit cbb4b330b84abde03f5faca678e7f6cfe42c6e07
Author: Stephan Haller <nomad at froevel.de>
Date:   Thu Jan 28 14:54:05 2016 +0100

    Fix a division by zero bug when calculating x and y coordinates of each cell in _xfdashboard_dynamic_table_layout_update_layout_data() and correct allocation of container to get scroll bars visible if neccessary (the allocation of container was not set at all and that was the bug).
---
 xfdashboard/dynamic-table-layout.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/xfdashboard/dynamic-table-layout.c b/xfdashboard/dynamic-table-layout.c
index 911ccfb..55716e0 100644
--- a/xfdashboard/dynamic-table-layout.c
+++ b/xfdashboard/dynamic-table-layout.c
@@ -139,12 +139,12 @@ static void _xfdashboard_dynamic_table_layout_update_layout_data(XfdashboardDyna
 		else if(inWidth>0.0f)
 		{
 			columns=MIN(ceil(inWidth/largestWidth), priv->numberChildren);
-			do
+			childWidth=(columns*largestWidth)+((columns-1)*priv->columnSpacing);
+			while(columns>1 && childWidth>inWidth)
 			{
 				childWidth=(columns*largestWidth)+((columns-1)*priv->columnSpacing);
 				columns--;
 			}
-			while(columns>1 && childWidth>inWidth);
 
 			largestWidth=floor(inWidth-((columns-1)*priv->columnSpacing))/columns;
 			rows=ceil((double)priv->numberChildren / (double)columns);
@@ -152,12 +152,12 @@ static void _xfdashboard_dynamic_table_layout_update_layout_data(XfdashboardDyna
 		else if(inHeight>0.0f)
 		{
 			rows=MIN(ceil(inHeight/largestHeight), priv->numberChildren);
-			do
+			childHeight=(rows*largestHeight)+((rows-1)*priv->rowSpacing);
+			while(rows>1 && childHeight>inHeight)
 			{
 				childHeight=(rows*largestHeight)+((rows-1)*priv->rowSpacing);
 				rows--;
 			}
-			while(rows>1 && childHeight>inHeight);
 
 			largestHeight=floor(inHeight-((rows-1)*priv->rowSpacing))/rows;
 			columns=ceil((double)priv->numberChildren / (double)rows);
@@ -277,7 +277,10 @@ static void _xfdashboard_dynamic_table_layout_get_preferred_width(ClutterLayoutM
 	if(priv->columns>0)
 	{
 		maxMinWidth=(priv->columns-1)*priv->columnSpacing;
-		if(maxNaturalWidth==0.0f) maxNaturalWidth=g_array_index(priv->columnCoords, gfloat, priv->columns);
+		if(maxNaturalWidth==0.0f)
+		{
+			maxNaturalWidth=g_array_index(priv->columnCoords, gfloat, priv->columns);
+		}
 	}
 
 	/* Set return values */
@@ -352,6 +355,13 @@ static void _xfdashboard_dynamic_table_layout_allocate(ClutterLayoutManager *sel
 															width,
 															height);
 
+	/* Set container allocation */
+	childAllocation.x1=0;
+	childAllocation.y1=0;
+	childAllocation.x2=g_array_index(priv->columnCoords, gfloat, priv->columns)-priv->columnSpacing;
+	childAllocation.y2=g_array_index(priv->rowCoords, gfloat, priv->rows)-priv->rowSpacing;
+	clutter_actor_allocate(CLUTTER_ACTOR(inContainer), &childAllocation, inFlags);
+
 	/* Determine allocation for each visible child */
 	i=0;
 	clutter_actor_iter_init(&iter, CLUTTER_ACTOR(inContainer));

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list