After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 548052 - gtk_widget_get_allocation returns widget->allocation by value
gtk_widget_get_allocation returns widget->allocation by value
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.13.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-08-16 18:29 UTC by Torsten Schoenfeld
Modified: 2009-06-22 00:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Torsten Schoenfeld 2008-08-16 18:29:30 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?
Comment 1 Christian Dywan 2008-08-26 01:40:40 UTC
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.
Comment 2 Michael Natterer 2008-09-02 14:15:00 UTC
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.
Comment 3 Michael Natterer 2008-09-02 16:06:59 UTC
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.
Comment 4 Javier Jardón (IRC: jjardon) 2009-06-22 00:50:20 UTC
Tracker bug for the discussion/solution: bug #585211