summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>2000-02-10 21:13:41 +0000
committerTim Janik <timj@src.gnome.org>2000-02-10 21:13:41 +0000
commit3f8d44d715688545d2034ccd4e562414b376169b (patch)
tree240d289ec04a49e17adb0619f827128d6cd6bdd0
parentc39a5a1c6f599f177dc366f454d05a410591b378 (diff)
downloadgdk-pixbuf-3f8d44d715688545d2034ccd4e562414b376169b.tar.gz
guard against guint wrap arounds in allocation.width.
Thu Feb 10 16:16:35 2000 Tim Janik <timj@gtk.org> * gtk/gtkspinbutton.c (gtk_spin_button_size_allocate): guard against guint wrap arounds in allocation.width. * gtk/gtktable.c (gtk_table_size_allocate_pass1): repeat shrinking process untill we fit the allocation given.
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-08
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-28
-rw-r--r--ChangeLog.pre-2-48
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--gtk/gtkspinbutton.c3
-rw-r--r--gtk/gtktable.c70
9 files changed, 104 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index f1dd2b282..f65889417 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Feb 10 16:16:35 2000 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c (gtk_spin_button_size_allocate): guard against
+ guint wrap arounds in allocation.width.
+
+ * gtk/gtktable.c (gtk_table_size_allocate_pass1): repeat shrinking
+ process untill we fit the allocation given.
+
Tue Feb 8 09:38:29 2000 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c:
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index f1dd2b282..f65889417 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,11 @@
+Thu Feb 10 16:16:35 2000 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c (gtk_spin_button_size_allocate): guard against
+ guint wrap arounds in allocation.width.
+
+ * gtk/gtktable.c (gtk_table_size_allocate_pass1): repeat shrinking
+ process untill we fit the allocation given.
+
Tue Feb 8 09:38:29 2000 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index f1dd2b282..f65889417 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,11 @@
+Thu Feb 10 16:16:35 2000 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c (gtk_spin_button_size_allocate): guard against
+ guint wrap arounds in allocation.width.
+
+ * gtk/gtktable.c (gtk_table_size_allocate_pass1): repeat shrinking
+ process untill we fit the allocation given.
+
Tue Feb 8 09:38:29 2000 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c:
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index f1dd2b282..f65889417 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,11 @@
+Thu Feb 10 16:16:35 2000 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c (gtk_spin_button_size_allocate): guard against
+ guint wrap arounds in allocation.width.
+
+ * gtk/gtktable.c (gtk_table_size_allocate_pass1): repeat shrinking
+ process untill we fit the allocation given.
+
Tue Feb 8 09:38:29 2000 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c:
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index f1dd2b282..f65889417 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,11 @@
+Thu Feb 10 16:16:35 2000 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c (gtk_spin_button_size_allocate): guard against
+ guint wrap arounds in allocation.width.
+
+ * gtk/gtktable.c (gtk_table_size_allocate_pass1): repeat shrinking
+ process untill we fit the allocation given.
+
Tue Feb 8 09:38:29 2000 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index f1dd2b282..f65889417 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,11 @@
+Thu Feb 10 16:16:35 2000 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c (gtk_spin_button_size_allocate): guard against
+ guint wrap arounds in allocation.width.
+
+ * gtk/gtktable.c (gtk_table_size_allocate_pass1): repeat shrinking
+ process untill we fit the allocation given.
+
Tue Feb 8 09:38:29 2000 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index f1dd2b282..f65889417 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,11 @@
+Thu Feb 10 16:16:35 2000 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkspinbutton.c (gtk_spin_button_size_allocate): guard against
+ guint wrap arounds in allocation.width.
+
+ * gtk/gtktable.c (gtk_table_size_allocate_pass1): repeat shrinking
+ process untill we fit the allocation given.
+
Tue Feb 8 09:38:29 2000 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c:
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 9fce7e58a..3da175438 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -469,7 +469,8 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
g_return_if_fail (allocation != NULL);
child_allocation = *allocation;
- child_allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness;
+ if (child_allocation.width > ARROW_SIZE + 2 * widget->style->klass->xthickness)
+ child_allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness;
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, &child_allocation);
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index b18a9a9d8..a55a0ea6f 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -1354,21 +1354,32 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
}
}
- /* Check to see if we were allocated less width than we requested.
+ /* Check to see if we were allocated less width than we requested,
+ * then shrink until we fit the size give.
*/
- if ((width > real_width) && (nshrink >= 1))
+ if (width > real_width)
{
- width = width - real_width;
-
- for (col = 0; col < table->ncols; col++)
- if (table->cols[col].shrink)
- {
- extra = width / nshrink;
- table->cols[col].allocation = MAX (1, (gint)table->cols[col].allocation - extra);
-
- width -= extra;
- nshrink -= 1;
- }
+ gint total_nshrink = nshrink;
+
+ extra = width - real_width;
+ while (total_nshrink > 0 && extra > 0)
+ {
+ nshrink = total_nshrink;
+ for (col = 0; col < table->ncols; col++)
+ if (table->cols[col].shrink)
+ {
+ gint allocation = table->cols[col].allocation;
+
+ table->cols[col].allocation = MAX (1, (gint) table->cols[col].allocation - extra / nshrink);
+ extra -= allocation - table->cols[col].allocation;
+ nshrink -= 1;
+ if (table->cols[col].allocation < 2)
+ {
+ total_nshrink -= 1;
+ table->cols[col].shrink = FALSE;
+ }
+ }
+ }
}
}
@@ -1433,20 +1444,31 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
}
/* Check to see if we were allocated less height than we requested.
+ * then shrink until we fit the size give.
*/
- if ((height > real_height) && (nshrink >= 1))
+ if (height > real_height)
{
- height = height - real_height;
+ gint total_nshrink = nshrink;
- for (row = 0; row < table->nrows; row++)
- if (table->rows[row].shrink)
- {
- extra = height / nshrink;
- table->rows[row].allocation = MAX (1, (gint)table->rows[row].allocation - extra);
-
- height -= extra;
- nshrink -= 1;
- }
+ extra = height - real_height;
+ while (total_nshrink > 0 && extra > 0)
+ {
+ nshrink = total_nshrink;
+ for (row = 0; row < table->nrows; row++)
+ if (table->rows[row].shrink)
+ {
+ gint allocation = table->rows[row].allocation;
+
+ table->rows[row].allocation = MAX (1, (gint) table->rows[row].allocation - extra / nshrink);
+ extra -= allocation - table->rows[row].allocation;
+ nshrink -= 1;
+ if (table->rows[row].allocation < 2)
+ {
+ total_nshrink -= 1;
+ table->rows[row].shrink = FALSE;
+ }
+ }
+ }
}
}
}