appF.xml revision 9e7bcd65
19e7bcd65Smrg<appendix id='Resource_Configuration_Management'>
29e7bcd65Smrg<title>Resource Configuration Management</title>
39e7bcd65Smrg<para>
49e7bcd65SmrgSetting and changing resources in X applications can be difficult for
59e7bcd65Smrgboth the application programmer and the end user.  <emphasis role='strong'>Resource
69e7bcd65SmrgConfiguration Management (RCM)</emphasis> addresses this problem by changing
79e7bcd65Smrgthe <function>X Intrinsics</function> to immediately modify a resource for a
89e7bcd65Smrgspecified widget and each child widget in the hierarchy.
99e7bcd65SmrgIn this context, immediate means: no sourcing of a resource
109e7bcd65Smrgfile is required; the application does not need to be restarted for the
119e7bcd65Smrgnew resource values to take effect; and the change
129e7bcd65Smrgoccurs immediately.
139e7bcd65Smrg</para>
149e7bcd65Smrg
159e7bcd65Smrg<para>
169e7bcd65SmrgThe main difference between <function>RCM</function> and the <function>Editres</function>
179e7bcd65Smrgprotocol is that the <function>RCM</function>
189e7bcd65Smrgcustomizing hooks reside in the <function>Intrinsics</function> and thus are linked with
199e7bcd65Smrgother toolkits such as Motif and the Athena widgets.  However, the
209e7bcd65Smrg<function>EditRes</function> protocol requires the application to link with the
219e7bcd65Smrg<function>EditRes</function>
229e7bcd65Smrgroutines in the Xmu library and Xmu is not used by all applications that
239e7bcd65Smrguse Motif.  Also, the <function>EditRes</function> protocol uses ClientMessage,
249e7bcd65Smrgwhereas the
259e7bcd65Smrg<function>RCM</function> <function>Intrinsics</function> hooks use <function>PropertyNotify</function> events.
269e7bcd65Smrg</para>
279e7bcd65Smrg
289e7bcd65Smrg<para>
299e7bcd65SmrgX Properties and the <function>PropertyNotify</function> events are used
309e7bcd65Smrgto implement <function>RCM</function> and
319e7bcd65Smrgallow on-the-fly resource customization.  When the X Toolkit is
329e7bcd65Smrginitialized, two atoms are interned with the strings
339e7bcd65Smrg<emphasis remap='I'>Custom Init</emphasis> and
349e7bcd65Smrg<emphasis remap='I'>Custom Data</emphasis>.  Both
359e7bcd65Smrg<function>_XtCreatePopupShell</function>
369e7bcd65Smrgand
379e7bcd65Smrg<function>_XtAppCreateShell</function>
389e7bcd65Smrgregister a <function>PropertyNotify</function> event handler to handle these properties.
399e7bcd65Smrg</para>
409e7bcd65Smrg
419e7bcd65Smrg<para>
429e7bcd65SmrgA customization tool uses the <emphasis remap='I'>Custom Init</emphasis> property to <emphasis remap='I'>ping</emphasis> an
439e7bcd65Smrgapplication to get the application's toplevel window.  When the
449e7bcd65Smrgapplication's property notify event handler is invoked, the handler
459e7bcd65Smrgdeletes the property.  No data is transferred in this property.
469e7bcd65Smrg</para>
479e7bcd65Smrg
489e7bcd65Smrg<para>
499e7bcd65SmrgA customization tool uses the <emphasis remap='I'>Custom Data</emphasis> property to tell an
509e7bcd65Smrgapplication that it should change a resource's value.  The data in
519e7bcd65Smrgthe property contains the length of the resource name (the number
529e7bcd65Smrgof bytes in the resource name), the resource name and the new
539e7bcd65Smrgvalue for the resource.  This property's type is <function>XA_STRING</function> and
549e7bcd65Smrgthe format of the string is:
559e7bcd65Smrg</para>
569e7bcd65Smrg<orderedlist>
579e7bcd65Smrg  <listitem>
589e7bcd65Smrg    <para>
599e7bcd65SmrgThe length of the resource name (the number of bytes in
609e7bcd65Smrgthe resource name)
619e7bcd65Smrg    </para>
629e7bcd65Smrg  </listitem>
639e7bcd65Smrg  <listitem>
649e7bcd65Smrg    <para>
659e7bcd65SmrgOne space character
669e7bcd65Smrg    </para>
679e7bcd65Smrg  </listitem>
689e7bcd65Smrg  <listitem>
699e7bcd65Smrg    <para>
709e7bcd65SmrgThe resource name
719e7bcd65Smrg    </para>
729e7bcd65Smrg  </listitem>
739e7bcd65Smrg  <listitem>
749e7bcd65Smrg    <para>
759e7bcd65SmrgOne space character
769e7bcd65Smrg    </para>
779e7bcd65Smrg  </listitem>
789e7bcd65Smrg  <listitem>
799e7bcd65Smrg    <para>
809e7bcd65SmrgThe resource value
819e7bcd65Smrg    </para>
829e7bcd65Smrg  </listitem>
839e7bcd65Smrg</orderedlist>
849e7bcd65Smrg<para>
859e7bcd65SmrgWhen setting the application's resource, the event handler calls
869e7bcd65Smrgfunctions to walk the application's widget tree, determining which
879e7bcd65Smrgwidgets are affected by the resource string, and then applying the value
889e7bcd65Smrgwith
899e7bcd65Smrg<xref linkend='XtSetValues' xrefstyle='select: title'/>.
909e7bcd65SmrgAs the widget tree is recursively descended, at
919e7bcd65Smrgeach level in the widget tree a resource part is tested for a match.
929e7bcd65SmrgWhen the entire resource string has been matched, the value is applied
939e7bcd65Smrgto the widget or widgets.
949e7bcd65Smrg</para>
959e7bcd65Smrg
969e7bcd65Smrg<para>
979e7bcd65SmrgBefore a value is set on a widget, it is first determined if the last
989e7bcd65Smrgpart of the resource is a valid resource for that widget.  It must also
999e7bcd65Smrgadd the resource to the application's resource database and then query
1009e7bcd65Smrgit using specific resource strings that is builds from the widget
1019e7bcd65Smrginformation.
1029e7bcd65Smrg</para>
1039e7bcd65Smrg</appendix>
104