Re: rendering-cleanup-next



Hi,

On Sat, Sep 11, 2010 at 12:57 PM, Benjamin Otte <otte gnome org> wrote:
> Ugh, I'd always assume that widget.get_width() would give me the width
> of the widget, not the width the widget thought would be ideal but had
> nothing to do with reality. Also, a width getter would never return 2
> values for me.
> Should we maybe rename it to gtk_size_request_get_natural/minimum_width()?
> Tristan?

You really want a single method to do natural and minimum, or else
it's really annoying for implementors (the methods share too much
code).

If going this road, maybe go for consistency with Clutter: call it
get_preferred_width(). In earlier GTK patches it was
get_desired_width(). May as well match Clutter though right?

The problem with having a get_width() that returns allocation is that
widgets don't have to have an allocation. Either they've never been
allocated at all, or it's out of date. In both those cases, the
request is closer to reality.

I guess that's why Clutter's get_width() returns allocation if updated
and request otherwise ;-)

btw if there's a get_allocated_width() (or whatever it's called), it'd
be nice to put in:

if (widget needs allocation)
 {
   g_warning("get_allocated_width() called on a widget that has not
yet been allocated. Widgets are only guaranteed to be allocated inside
draw() or if you have just allocated them yourself.");
  }

Also, the gtk_widget_draw() wrapper could usefully have:

 if (widget needs allocation)
   g_warning("widget must have up-to-date allocation in order to draw it");

Havoc


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