app: make the new rounding code in GimpSpinScale less totally stupid
This commit is contained in:
@ -623,13 +623,21 @@ gimp_spin_scale_change_value (GtkWidget *widget,
|
|||||||
|
|
||||||
digits = gtk_spin_button_get_digits (spin_button);
|
digits = gtk_spin_button_get_digits (spin_button);
|
||||||
|
|
||||||
/* round the value to the possible precision of the spinbutton, so
|
if (digits > 0)
|
||||||
* a focus-out will not change the value again, causing inadvertend
|
{
|
||||||
* adjustment signals.
|
gint power = 1;
|
||||||
*/
|
|
||||||
value *= powl (10, digits);
|
while (digits--)
|
||||||
value = RINT (value);
|
power *= 10;
|
||||||
value /= powl (10, digits);
|
|
||||||
|
/* round the value to the possible precision of the spinbutton, so
|
||||||
|
* a focus-out will not change the value again, causing inadvertend
|
||||||
|
* adjustment signals.
|
||||||
|
*/
|
||||||
|
value *= power;
|
||||||
|
value = RINT (value);
|
||||||
|
value /= power;
|
||||||
|
}
|
||||||
|
|
||||||
gtk_adjustment_set_value (adjustment, value);
|
gtk_adjustment_set_value (adjustment, value);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user