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