Replace a really gross way of rounding to a specified number of digits.

2004-10-06  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
	gross way of rounding to a specified number of digits.  (#145232,
	Peter Zelezny, patch by Soeren Sandmann)
This commit is contained in:
Matthias Clasen 2004-10-06 05:11:36 +00:00 committed by Matthias Clasen
parent 73e7b0838c
commit f0d016ef38
5 changed files with 32 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2004-10-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
gross way of rounding to a specified number of digits. (#145232,
Peter Zelezny, patch by Soeren Sandmann)
Wed Oct 6 00:45:04 2004 <timj@birnet.org>
* gdk/gdkwindow.c (gdk_window_is_viewable): check the iteration window

View File

@ -1,3 +1,9 @@
2004-10-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
gross way of rounding to a specified number of digits. (#145232,
Peter Zelezny, patch by Soeren Sandmann)
Wed Oct 6 00:45:04 2004 <timj@birnet.org>
* gdk/gdkwindow.c (gdk_window_is_viewable): check the iteration window

View File

@ -1,3 +1,9 @@
2004-10-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
gross way of rounding to a specified number of digits. (#145232,
Peter Zelezny, patch by Soeren Sandmann)
Wed Oct 6 00:45:04 2004 <timj@birnet.org>
* gdk/gdkwindow.c (gdk_window_is_viewable): check the iteration window

View File

@ -1,3 +1,9 @@
2004-10-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_real_change_value): Replace a really
gross way of rounding to a specified number of digits. (#145232,
Peter Zelezny, patch by Soeren Sandmann)
Wed Oct 6 00:45:04 2004 <timj@birnet.org>
* gdk/gdkwindow.c (gdk_window_is_viewable): check the iteration window

View File

@ -2390,12 +2390,15 @@ gtk_range_real_change_value (GtkRange *range,
if (range->round_digits >= 0)
{
char buffer[128];
glong power;
gint i;
/* This is just so darn lame. */
g_snprintf (buffer, 128, "%0.*f",
range->round_digits, value);
sscanf (buffer, "%lf", &value);
i = range->round_digits;
power = 1;
while (i--)
power *= 10;
value = floor ((value * power) + 0.5) / power;
}
if (range->adjustment->value != value)