Re: Size requisition changes
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list redhat com
- Subject: Re: Size requisition changes
- Date: 24 Feb 1999 23:53:06 -0500
Martin Baulig <martin@home-of-linux.org> writes:
> Hello,
>
> my GTop change below seems to work fine, but some other question:
>
> Is there any need to call gtk_widget_size_request () and then throw
> away the returned requisition ? The code in question is in
> gnome-pim/gncal/gncal-full-day.c around line 208 (after applying the
> requisition change):
>
> gtk_widget_size_request (child->widget, &child_requisition); /* FIXME: is this needed? */
> gtk_widget_size_allocate (child->widget, &allocation);
>
> The &child_requisition is not used at all.
When gtk_widget_size_request() is called on a widget, you
must always call gtk_widget_size_request on your children, even
if you ignore their requisitions. You can, however, pass in NULL
as the second parameter to gtk_widget_size_request().
> > If your code is affected by these changes (there are
> > about 4 places in GNOME that will print out warnings),
> > you should probably not change it immediately, but
> > wait for the next release of GTK+, and then call
> > AM_PATH_GTK () with a version of 1.1.16, since the
> > necesarry changes will not be compatible with older
> > versions of GTK+.
> >
> > I apologize for any inconvience this causes (it shouldn't
> > really be much - I'll do the GNOME changes myself),
> > but I think this change is necesary and the
> > right thing to do.
>
> Just a short question (GTop is one of the places):
>
> After applying the following patch to GTop:
>
> ------------------------------------------------------------------------
> --- gtop-procview.c 1999/02/15 04:44:15 1.12
> +++ gtop-procview.c 1999/02/22 22:26:39
> @@ -332,10 +332,11 @@
> requisition->height = GTK_CONTAINER (widget)->border_width * 2;
>
> if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
> - gtk_widget_size_request (bin->child, &bin->child->requisition);
> + GtkRequisition child_requisition;
> + gtk_widget_size_request (bin->child, &child_requisition);
>
> - requisition->width += bin->child->requisition.width;
> - requisition->height += bin->child->requisition.height;
> + requisition->width += child_requisition.width;
> + requisition->height += child_requisition.height;
> }
> }
>
> ------------------------------------------------------------------------
>
> the warnings went away - does this gtk_widget_size_request () return
> the correct requisition in &child_requsition or do I need to call
> gtk_widget_get_child_requisition again or something else ?
The source code in gtk_widget_size_request looks like:
/* ... emit the size request signal ... */
if (requisition)
gtk_widget_get_child_requisition (widget, requisition);
So, yes, the requisition from gtk_widget_size_request is
identical to that from gtk_widget_get_child_requisition().
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]