gtk/gtktable.c Fixed problem with division by zero in row/column-spanned

Tue Feb  3 00:12:00 1998  Owen Taylor  <owt1@cornell.edu>
	* gtk/gtktable.c
	  Fixed problem with division by zero in row/column-spanned
	  tables. Also removed a bunch of conditionals by making
	  the observation that x/1 == x.
This commit is contained in:
Owen Taylor 1998-02-03 05:57:31 +00:00 committed by Owen Taylor
parent febe6498f2
commit a8629917ae
8 changed files with 55 additions and 27 deletions

View File

@ -1,3 +1,9 @@
Tue Feb 3 00:12:00 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktable.c
Fixed problem with division by zero in row/column-spanned
tables. Also removed a bunch of conditionals by making
the observation that x/1 == x.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwindow.c: * gtk/gtkwindow.c:
@ -213,6 +219,7 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org>
* gtk/testgtk.c: some changes because of all the above ;) * gtk/testgtk.c: some changes because of all the above ;)
>>>>>>> 1.103
Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised

View File

@ -1,3 +1,9 @@
Tue Feb 3 00:12:00 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktable.c
Fixed problem with division by zero in row/column-spanned
tables. Also removed a bunch of conditionals by making
the observation that x/1 == x.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwindow.c: * gtk/gtkwindow.c:
@ -213,6 +219,7 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org>
* gtk/testgtk.c: some changes because of all the above ;) * gtk/testgtk.c: some changes because of all the above ;)
>>>>>>> 1.103
Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised

View File

@ -1,3 +1,9 @@
Tue Feb 3 00:12:00 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktable.c
Fixed problem with division by zero in row/column-spanned
tables. Also removed a bunch of conditionals by making
the observation that x/1 == x.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwindow.c: * gtk/gtkwindow.c:
@ -213,6 +219,7 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org>
* gtk/testgtk.c: some changes because of all the above ;) * gtk/testgtk.c: some changes because of all the above ;)
>>>>>>> 1.103
Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised

View File

@ -1,3 +1,9 @@
Tue Feb 3 00:12:00 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktable.c
Fixed problem with division by zero in row/column-spanned
tables. Also removed a bunch of conditionals by making
the observation that x/1 == x.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwindow.c: * gtk/gtkwindow.c:
@ -213,6 +219,7 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org>
* gtk/testgtk.c: some changes because of all the above ;) * gtk/testgtk.c: some changes because of all the above ;)
>>>>>>> 1.103
Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised

View File

@ -1,3 +1,9 @@
Tue Feb 3 00:12:00 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktable.c
Fixed problem with division by zero in row/column-spanned
tables. Also removed a bunch of conditionals by making
the observation that x/1 == x.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwindow.c: * gtk/gtkwindow.c:
@ -213,6 +219,7 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org>
* gtk/testgtk.c: some changes because of all the above ;) * gtk/testgtk.c: some changes because of all the above ;)
>>>>>>> 1.103
Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised

View File

@ -1,3 +1,9 @@
Tue Feb 3 00:12:00 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktable.c
Fixed problem with division by zero in row/column-spanned
tables. Also removed a bunch of conditionals by making
the observation that x/1 == x.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwindow.c: * gtk/gtkwindow.c:
@ -213,6 +219,7 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org>
* gtk/testgtk.c: some changes because of all the above ;) * gtk/testgtk.c: some changes because of all the above ;)
>>>>>>> 1.103
Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised

View File

@ -1,3 +1,9 @@
Tue Feb 3 00:12:00 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktable.c
Fixed problem with division by zero in row/column-spanned
tables. Also removed a bunch of conditionals by making
the observation that x/1 == x.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org> Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwindow.c: * gtk/gtkwindow.c:
@ -213,6 +219,7 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org>
* gtk/testgtk.c: some changes because of all the above ;) * gtk/testgtk.c: some changes because of all the above ;)
>>>>>>> 1.103
Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised

View File

@ -964,12 +964,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
for (col = 0; col < table->ncols; col++) for (col = 0; col < table->ncols; col++)
{ {
extra = width / (table->ncols - col); extra = width / (table->ncols - col);
table->cols[col].allocation = extra;
if ((col + 1) == table->ncols)
table->cols[col].allocation = width;
else
table->cols[col].allocation = extra;
width -= extra; width -= extra;
} }
} }
@ -1001,10 +996,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->cols[col].expand) if (table->cols[col].expand)
{ {
extra = width / nexpand; extra = width / nexpand;
if (nexpand == 1) table->cols[col].allocation += extra;
table->cols[col].allocation += width;
else
table->cols[col].allocation += extra;
width -= extra; width -= extra;
nexpand -= 1; nexpand -= 1;
@ -1021,10 +1013,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->cols[col].shrink) if (table->cols[col].shrink)
{ {
extra = width / nshrink; extra = width / nshrink;
if (nshrink == 1) table->cols[col].allocation -= extra;
table->cols[col].allocation -= width;
else
table->cols[col].allocation -= extra;
width -= extra; width -= extra;
nshrink -= 1; nshrink -= 1;
@ -1053,11 +1042,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
for (row = 0; row < table->nrows; row++) for (row = 0; row < table->nrows; row++)
{ {
extra = height / (table->nrows - row); extra = height / (table->nrows - row);
if ((row + 1) == table->nrows) table->rows[row].allocation = extra;
table->rows[row].allocation = height;
else
table->rows[row].allocation = extra;
height -= extra; height -= extra;
} }
} }
@ -1089,10 +1074,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->rows[row].expand) if (table->rows[row].expand)
{ {
extra = height / nexpand; extra = height / nexpand;
if (nexpand == 1) table->rows[row].allocation += extra;
table->rows[row].allocation += height;
else
table->rows[row].allocation += extra;
height -= extra; height -= extra;
nexpand -= 1; nexpand -= 1;
@ -1109,10 +1091,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->rows[row].shrink) if (table->rows[row].shrink)
{ {
extra = height / nshrink; extra = height / nshrink;
if (nshrink == 1) table->rows[row].allocation -= extra;
table->rows[row].allocation -= height;
else
table->rows[row].allocation -= extra;
height -= extra; height -= extra;
nshrink -= 1; nshrink -= 1;