summaryrefslogtreecommitdiff
path: root/gtk/gtkcellareabox.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2010-11-14 10:43:00 +0100
committerKristian Rietveld <kris@gtk.org>2010-11-28 19:54:18 +0100
commit354b3412ddcdd73cd1bc9f2bc23a805d67e7fbf5 (patch)
tree9b83d84019879ede111864d0229ee839cbfb39f4 /gtk/gtkcellareabox.c
parent5df7dab3cfdafad8656366edf4848329035b109d (diff)
downloadgtk+-354b3412ddcdd73cd1bc9f2bc23a805d67e7fbf5.tar.gz
Available extra space could be less than zero
The allocated size, or (horizontally speaking) for-width size, can be smaller than the sum of all minimum widths. For example when the user is resizing tree view columns manually.
Diffstat (limited to 'gtk/gtkcellareabox.c')
-rw-r--r--gtk/gtkcellareabox.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gtk/gtkcellareabox.c b/gtk/gtkcellareabox.c
index c29e260ad0..99b5b41685 100644
--- a/gtk/gtkcellareabox.c
+++ b/gtk/gtkcellareabox.c
@@ -770,7 +770,10 @@ get_allocated_cells (GtkCellAreaBox *box,
/* Distribute cells naturally within the group */
avail_size -= (visible_cells - 1) * priv->spacing;
- avail_size = gtk_distribute_natural_allocation (avail_size, visible_cells, sizes);
+ if (avail_size > 0)
+ avail_size = gtk_distribute_natural_allocation (avail_size, visible_cells, sizes);
+ else
+ avail_size = 0;
/* Calculate/distribute expand for cells */
if (expand_cells > 0)
@@ -1535,7 +1538,10 @@ compute_group_size_for_opposing_orientation (GtkCellAreaBox *box,
for (i = 0; i < n_sizes; i++)
avail_size -= orientation_sizes[i].minimum_size;
- avail_size = gtk_distribute_natural_allocation (avail_size, n_sizes, orientation_sizes);
+ if (avail_size > 0)
+ avail_size = gtk_distribute_natural_allocation (avail_size, n_sizes, orientation_sizes);
+ else
+ avail_size = 0;
/* Calculate/distribute expand for cells */
if (group->expand_cells > 0)
@@ -1607,7 +1613,10 @@ compute_size_for_opposing_orientation (GtkCellAreaBox *box,
for (i = 0; i < n_groups; i++)
avail_size -= orientation_sizes[i].minimum_size;
- avail_size = gtk_distribute_natural_allocation (avail_size, n_groups, orientation_sizes);
+ if (avail_size > 0)
+ avail_size = gtk_distribute_natural_allocation (avail_size, n_groups, orientation_sizes);
+ else
+ avail_size = 0;
/* Calculate/distribute expand for groups */
if (n_expand_groups > 0)