Re: Outstanding patches, #58680 and #58681



"Matthias Clasen" <matthiasc poet de> writes:

> The first bug seems to be a simple typo: the second argument to
> compute_double_length
> should probably be spin_button->digits in both calls.
> Ok to commit the following patch ?
> Index: gtk/gtkspinbutton.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkspinbutton.c,v
> retrieving revision 1.69
> diff -u -3 -p -u -r1.69 gtkspinbutton.c
> --- gtk/gtkspinbutton.c	2001/07/18 23:39:23	1.69
> +++ gtk/gtkspinbutton.c	2001/08/07 12:38:32
> @@ -583,7 +583,7 @@ gtk_spin_button_size_request (GtkWidget
>        w = MIN (string_len, 10) * PANGO_PIXELS
> (metrics.approximate_digit_width);
>        width = MAX (width, w);
>        string_len = compute_double_length (spin_button->adjustment->lower,
> -					  spin_button->adjustment->step_increment);
> +					  spin_button->digits);
>        w = MIN (string_len, 10) * PANGO_PIXELS
> (metrics.approximate_digit_width);
>        width = MAX (width, w);


Looks good.

> While being here, there is another bug related to spin buttons:
> Is there any reason to restrict the width of the spinbutton entry field
> to 10 places, but on the other hand allow digits to go up to 20 ?
> If this is just historical baggage, here is a patch to remove it.Ok to

Well, the problem here is that sometimes the range passed in might
not be reasonable. For instance, in the property editor, the range
for the spinbutton for some properties is [0,G_MAX_DOUBLE]. This
results in a spinbutton 300+ characters wide.

A better sanitization here might be something like:

 max_length = MAX (10, compute_double_length (1000000000 * spin_button->step_increment, spin_button->digits));

That is, there really isn't any need to display a spin button so wide
that it would take more than a billion presses of an arrow to get
to one end or the other... [ the 10 is in there to deal with the
case of spin_button->step_increment == 0 ]

Regards,
                                        Owen

> commit this patch ?Index: gtk/gtkspinbutton.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkspinbutton.c,v
> retrieving revision 1.69
> diff -u -3 -p -u -r1.69 gtkspinbutton.c
> --- gtk/gtkspinbutton.c	2001/07/18 23:39:23	1.69
> +++ gtk/gtkspinbutton.c	2001/08/07 12:26:40
> @@ -580,11 +580,11 @@ gtk_spin_button_size_request (GtkWidget
> 
>        string_len = compute_double_length (spin_button->adjustment->upper,
>                                            spin_button->digits);
> -      w = MIN (string_len, 10) * PANGO_PIXELS
> (metrics.approximate_digit_width);
> +      w = string_len * PANGO_PIXELS (metrics.approximate_digit_width);
>        width = MAX (width, w);
>        string_len = compute_double_length (spin_button->adjustment->lower,
>  					  spin_button->adjustment->step_increment);
> -      w = MIN (string_len, 10) * PANGO_PIXELS
> (metrics.approximate_digit_width);
> +      w = string_len * PANGO_PIXELS (metrics.approximate_digit_width);
>        width = MAX (width, w);
> 
>        requisition->width = width + ARROW_SIZE + 2 *
> widget->style->xthickness;




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