Re: fixing GtkScale default quantization



Tim Janik <timj gtk org> writes:
> 
> i just meant to fix default value quantization in scales to
> %.1f digits, and ran across GtkScale.digits. what's the deal
> with that field? there's not even a compatibility issue there,
> as 1.2 doesn't have it.
> it just completely duplicates GTK_RANGE (scale)->round_digits.
> 
> i intend to apply the following patch, any comments?
> 

The patch makes sense to me, I don't have any memory of why there's a
separate digits field in GtkScale. (The only reason I can think of is
that scale->digits doesn't actually change what's in the adjustment,
only changes what's displayed; while range->round_digits does change 
what goes in the adjustment; but probably the displayed value should
match what gets set on the adjustment.)

However IMO the default should remain 1 not -1, because for the vast
majority of scales you never want to see numbers like 5.234265109 and
you don't want the number of displayed decimal places to keep
changing. Perhaps the default should be 2 or 3, but it should be a
small fixed number.

A bug I noticed while looking at this is that "digits" gets clamped to
16, but the propery has a max of G_MAXINT. So we should have 
#define MAX_DIGITS and use that for the clamp and the property max.

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]