GtkAllocation accessor



Currently, gtk_widget_get_allocation is defined as:

void
gtk_widget_get_allocation (GtkWidget     *widget,
                           GtkAllocation *allocation)
{
  g_return_if_fail (GTK_IS_WIDGET (widget));
  g_return_if_fail (allocation != NULL);

  *allocation = widget->allocation;
}


To use it, I need to

GtkWidget *w = some_widget_new(some,properties);
GtkAlloction a;
gtk_widget_get_allocation(w, &a);
make use of a->width and friends
then free a?

Wouldn't

GtkAllocation * gtk_widget_get_allocation(GtkWidget *widget)
{
  return widget->allocation;
}

be easier to use / less of a memory management headache as the
memory already is allocated and controlled by the widget?

Any thoughts on why it was done this way / thoughts on the addition of
say a gtk_widget_get_allocation_pointer()?

Cheers,

Patrick


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