Re: Bug in get_preferred_height_for_width() [was Re: Minimum height for minimum width]



Hi,

I think I get what you're saying. If not I'll probably understand it
reading your code.

btw things are looking kind of messed up to me in the current code in
gtkwidget.c ... this:

      gtk_widget_get_preferred_width (widget, NULL, &natural_width);
      get_span_inside_border_horizontal (widget,
					 aux_info,
					 allocation->width,
					 natural_width,
					 &x, &w);

so natural_width has the margins in it, right? But it's centered
without removing those margins first. The code up in
get_span_inside_border() removes margins from allocation->width but
not natural_width.

It seems like we need to remove the margins to get
adjusted_natural_width. And then say in GtkContainer, we need that
adjusted_natural_width and we remove border_width from it, and then we
pass the twice-adjusted natural width with both margins and border
width and alignment-added-padding stripped down to the actual subclass
like GtkButton.

Without trying to code it and see if it works, it could look like:

(* adjust_size_allocation) (GtkWidget *widget,
                                       GtkOrientation orientation,
                                       gint           *for_size_opposite,
                                       gint           *natural_size,
                                       gint           *offset,
                                       gint           *adjusted_size);

where all four numbers are changing as we're chaining Widget->Container->Button

Might be nicer to do struct GtkAllocatedSize { int for_size_opposite;
int natural_size; int offset; int adjusted_size }  ?

Sorry I got this wrong in my original patch :-/

Havoc


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