# Resource Configuration Management

Setting and changing resources in X applications can be difficult for both the application programmer and the end user. Resource Configuration Management (RCM) addresses this problem by changing the `X Intrinsics` to immediately modify a resource for a specified widget and each child widget in the hierarchy. In this context, immediate means: no sourcing of a resource file is required; the application does not need to be restarted for the new resource values to take effect; and the change occurs immediately.

The main difference between `RCM` and the `Editres` protocol is that the `RCM` customizing hooks reside in the `Intrinsics` and thus are linked with other toolkits such as Motif and the Athena widgets. However, the `EditRes` protocol requires the application to link with the `EditRes` routines in the Xmu library and Xmu is not used by all applications that use Motif. Also, the `EditRes` protocol uses ClientMessage, whereas the `RCM` `Intrinsics` hooks use `PropertyNotify` events.

X Properties and the `PropertyNotify` events are used to implement `RCM` and allow on-the-fly resource customization. When the X Toolkit is initialized, two atoms are interned with the strings Custom Init and Custom Data. Both `_XtCreatePopupShell` and `_XtAppCreateShell` register a `PropertyNotify` event handler to handle these properties.

A customization tool uses the Custom Init property to ping an application to get the application's toplevel window. When the application's property notify event handler is invoked, the handler deletes the property. No data is transferred in this property.

A customization tool uses the Custom Data property to tell an application that it should change a resource's value. The data in the property contains the length of the resource name (the number of bytes in the resource name), the resource name and the new value for the resource. This property's type is `XA_STRING` and the format of the string is:

1. The length of the resource name (the number of bytes in the resource name)

2. One space character

3. The resource name

4. One space character

5. The resource value

When setting the application's resource, the event handler calls functions to walk the application's widget tree, determining which widgets are affected by the resource string, and then applying the value with . As the widget tree is recursively descended, at each level in the widget tree a resource part is tested for a match. When the entire resource string has been matched, the value is applied to the widget or widgets.

Before a value is set on a widget, it is first determined if the last part of the resource is a valid resource for that widget. It must also add the resource to the application's resource database and then query it using specific resource strings that is builds from the widget information.