[gtk+/native-layout] Added an argument check to gtk_distribute_natural_allocation()
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/native-layout] Added an argument check to gtk_distribute_natural_allocation()
- Date: Tue, 17 Aug 2010 05:37:05 +0000 (UTC)
commit 7d3cb3f9d9a73ffeb15737124bd545bae7ce0eaf
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Tue Aug 17 01:29:23 2010 -0400
Added an argument check to gtk_distribute_natural_allocation()
and clipped some values in gtkbox.c in case it was allocated less
than it requested.
gtk/gtkbox.c | 4 ++--
gtk/gtksizerequest.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index cdc5f1d..1f9b637 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -500,7 +500,7 @@ gtk_box_size_allocate (GtkWidget *widget,
else
{
/* Bring children up to size first */
- size = gtk_distribute_natural_allocation (size, nvis_children, sizes);
+ size = gtk_distribute_natural_allocation (MAX (0, size), nvis_children, sizes);
/* Calculate space which hasn't distributed yet,
* and is available for expanding children.
@@ -1004,7 +1004,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
else
{
/* Bring children up to size first */
- size = gtk_distribute_natural_allocation (size, nvis_children, sizes);
+ size = gtk_distribute_natural_allocation (MAX (0, size), nvis_children, sizes);
/* Calculate space which hasn't distributed yet,
* and is available for expanding children.
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 81c66f6..908cc39 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -584,6 +584,8 @@ gtk_distribute_natural_allocation (gint extra_space,
guint *spreading = g_newa (guint, n_requested_sizes);
gint i;
+ g_return_val_if_fail (extra_space >= 0, 0);
+
for (i = 0; i < n_requested_sizes; i++)
spreading[i] = i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]