GNOME Bugzilla – Bug 548052
gtk_widget_get_allocation returns widget->allocation by value
Last modified: 2009-06-22 00:50:20 UTC
During the recent sealing, gtk_widget_get_allocation was added to provide access to widget->allocation. It returns the allocation by value, so the calling code has no way to modify widget->allocation directly. I don't know how legal that is, but it used to be possible. And I think it's necessary for GtkContainer subclasses to be able to alter their own allocation struct member in the size_allocate handler. So, should the accessor be changed to return a pointer to the allocation member? If not, how would, say, bindings provide access to it for custom GtkContainer subclasses written in that bindings' language?
Ping. Since the reporter asks about a possible API change this bug should be addressed soonish, or it will be too late after the coming Gtk 2.14 release.
The function added is a getter, what you talk about (modifying widget->allocation) would be a setter. That setter is still missing. However I totally disagree with returning this struct by value, but that's another story. And yes, this must be addresses before 2.14.
Since we can't agree on anything here, it was decided to remove the new function entirely and have a general discussion about return by value in the next devel cycle. 2008-09-02 Michael Natterer <mitch@imendio.com> * gtk/gtkwidget.c (gtk_widget_get_allocation): removed this function because there is massive disagreement about how to implement it. Needs some general discussion in the next development cycle about how our C api should evolve. * gtk/gtk.symbols: changed accordingly.
Tracker bug for the discussion/solution: bug #585211