[comp.windows.x] Xt Revisions and XtGeometryDone

bjoyce@coherent.com (Bob Joyce) (12/06/89)

As the X Intrinsics manual states: "Homogeneous composite widgets often
find it convenient to treat the widget making the request the same as any 
other widget, possibly reconfiguring it as part of its layout process ... 
If it does this, it should return XtGeometryDone to inform
XtMakeGeometryRequest that it does not need to do the configuration itself".

Unfortunately, the proposed revisions to the manual make it impossible for 
a composite widget to treat its children uniformly.  The text reads: 
"To remain compatible with layout techniques used in older widgets (before
XtGeometryDone was added to the Intrinsics), a geometry manager should
avoid using XtResizeWidget or XtConfigureWidget on the child making the request
as the layout process of the child may be in an intermediate state".

From personal experience in implementing a form-like geometry manager widget,
I can attest to the benefits of XtGeometryDone/treating children uniformly.
I regard this as an important area that is best fixed before the document
becomes a standard.

I have a suggestion that achieves this objective.  Instead of deprecating the
invocation of XtResizeWidget() on the requesting child, have XtResizeWidget()
and XtConfigureWidget() treat widgets making geometry requests specially. When
XtResizeWidget() is called on a widget currently making a geometry request,
it would not invoke that widget's resize procedure.  

XtResizeWidget() would require a one-line change (see the "+" sign):

	void XtResizeWidget(w, width, height, borderWidth)
	    Widget w;
	    Dimension height, width, borderWidth;
	{
	    XWindowChanges changes;
	    Cardinal mask = 0;
	
	    ...	

	    if (mask != 0) {
		if (XtIsRealized(w))
		    XConfigureWindow(XtDisplay(w), XtWindow(w), mask, &changes);

	    if ((mask & (CWWidth | CWHeight)) &&
+		!XtIsMakingGeometryRequest(w) &&
		XtClass(w)->core_class.resize != (XtWidgetProc) NULL)
		    (*(w->core.widget_class->core_class.resize))(w);
	    }
	} /* XtResizeWidget */


This change does *not* change the semantics of XtResizeWidget(), except in the
case that the revision deprecates.  Thus, it should be transparent to all
Xt-developers not using the XtGeometryDone protocol.  Also, the time and space
overhead required to track the widgets making geometry requests should be
fairly small.  

Bob Joyce  Coherent Thought Inc, 3350 W. Bayshore Rd #205, Palo Alto, CA 94303
  UUCP: ...!{ames,sun,uunet}!coherent!bjoyce     Domain: bjoyce@coherent.com
  Internet: coherent!bjoyce@ames.arpa or ...@sun.com or ...uunet.uu.net
  Phone:    (415) 493-8805	      Fax: (415) 493-1555