Re: rendering-cleanup-next


On Sat, Sep 11, 2010 at 12:15 PM, Benjamin Otte <otte gnome org> wrote:
> What's you opinion on having gtk_widget_get_width() and
> gtk_widget_get_height() functions? They would just return
> widget->priv->allocation.width/height for now.
> Such functions would address your issues and would make writing draw
> functions pretty much as simple as they are now, without having to
> pass width and height. And in particular, they'd get rid of the need
> to think about allocations.
> Or would that be a too prominent API?

Yep, I was thinking/assuming there would be exactly this. The only
thing I'd add, I think they ought to be named something with
"allocated" in there, for a couple reasons:

- in many languages GtkSizeRequest::get_width() is already just
callable as widget.get_width()
- plain get_width() more naturally gets request, anyhow

Clutter has a hack where get_width() returns the allocation if valid
else the request, but this was a back compat hack / an attempt to be
nice to naive users who don't want to think about request vs.

The obvious API might be: get_allocated_width(),
get_allocated_height(), get_allocated_size(); or even change
get_allocation() to return width,height and add separate

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?
I guess the natural new way for this to work would be for gtk_paint to
pass the theme engine a cairo_t already translated and clipped to the
box the theme element is supposed to be inside. Maybe the new theme
branch has something more radical though.


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