Re: rendering-cleanup-next


On Tue, Sep 14, 2010 at 7:42 PM, Benjamin Otte <otte gnome org> wrote:
> I'm actually not sure about that. First, we don't have any code that
> defines if an allocation is valid or even defines what a "valid"
> allocation is. Or do we? gtk_widget_get_allocation() at least doesn't
> do anything there.

yes, we have GTK_WIDGET_ALLOC_NEEDED(). draw() should whine if an
alloc is needed.

I don't think there's much question here. Drawing without an updated
allocation is just a bug, plain and simple.

Widgets need this guarantee. For example if I'm coding GtkLabel, I
should be able to create the PangoLayout in size_allocate and assume
that I have the right layout in draw().
If you don't require updating the allocation, I might draw() some old
text that has been changed.

(Not saying GtkLabel works this way, I didn't look, just that if it
did work this way it would be correct and would have worked in GTK
2.x. And it's certainly easier to write a correct widget if we keep
this invariant.)


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