Re: gtk_widget_get_allocation



Hi,

On Fri, Apr 17, 2009 at 9:38 PM, Brian J. Tarricone <bjt23 cornell edu> wrote:
> I assume the issue was with returning a non-primitive type by-value and not
> as a pointer.

Right. The normal way in glib/gtk would definitely be as you say.

> void
> gtk_widget_get_allocation (GtkWidget     *widget,
>                           GtkAllocation *allocation)
> {
>    g_return_if_fail (GTK_IS_WIDGET (widget) && allocation);

but this should be two separate checks

>    memcpy (allocation, &widget->allocation, sizeof(*allocation));

and just:
 *allocation = widget->allocation;

should be fine.

Presumably some core gtk dev was arguing for the weird way though or
someone would have just fixed it ;-)

Havoc


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