Re: rendering-cleanup-next



On Sat, 2010-09-11 at 18:57 +0200, Benjamin Otte wrote:
> On Sat, Sep 11, 2010 at 6:29 PM, Havoc Pennington <hp pobox com> wrote:
> > - in many languages GtkSizeRequest::get_width() is already just
> > callable as widget.get_width()
> > - plain get_width() more naturally gets request, anyhow
> >
> 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?

Thanks for poking me on irc as I really have not been following this
thread (and it did not jump out at me with the explicit CC, I'll see
if I can configure something for that in my mail reader... or try to
at least glance at all or most of the gtk-devel traffic that rolls in)

As we briefly discussed on irc; I don't really care so much about
the name of the API so long as it make's sense. I suppose that if
we desire to change the name; the most natural name will be to match
clutter's get_preferred_width().

While on the topic of gtk_size_request_get[_preferred]_width(), I think
we really should be keeping both minimum and natural values as 2 return
values of the same api... because:

   - For any container code that needs to make a request, whether the
     natural or minimum size gets ignored or not; its better to at least
     force a some awareness about the height-for-width apis.

     In other words it should be impossible for a container widget
     author to use widget.get_minimum_width() and completely ignore
     the fact that there is a natural width (at least when a natural
     width is ignored, it should be obviously intentional or be code
     that needs fixing).

   - While the exported api could be different than the internal one,
     The signature should IMO be the same signature as the method
     invoked on the GtkSizeRequestIface

   - In most implementations of the ->get_width() request api there are
     some padding and border/style values to calculate which apply to
     both the minimum and natural size... so it makes sense to calculate
     both minimum/natural in a single pass (it would be a shame to make
     them be calculated twice in order to separate those calls).

For allocation apis, I would still prefer using an api that is clear
about the allocation (widget.get_allocation() or
widget.get_allocated_width())... as that is somehow less ambiguous 
and forces the caller to understand at least a little bit about
allocations.

Cheers,
          -Tristan


> 
> 
> > Something I just noticed, it looks like widgets are doing
> > get_allocation and looking at allocation.x,y still because gtk_paint_*
> > seems to assume that the cairo_t is not translated?
> >
> gtk_paint_*() does - at least in my branch - draw relative to the
> passed in cairo_t. As almost all the paint functions take
> x,y,width,height anyway it doesn't really matter where the origin of
> the cairo_t is. You'll notice in all the "Port to draw vfunc" patches
> that I removed allocation.x/y from the x/y parameters.
> The original paint functions that took a GdkWindow were
> window-relative so had to take into account allocation.x/y.
> 
> Benjamin
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list




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