diff options
author | Matt Dew <marcoz@osource.org> | 2011-10-25 22:33:55 -0600 |
---|---|---|
committer | Matt Dew <marcoz@osource.org> | 2011-10-25 22:33:55 -0600 |
commit | b3fbf9544cba045dcc876dff11843db3597b7647 (patch) | |
tree | c2696dae955e703510325657ebe6a6e3e7c4358e | |
parent | fc9afda459ed42e7a83856fdf5bac55e175e4120 (diff) |
proofread CH09.xml
-rw-r--r-- | specs/CH09.xml | 645 |
1 files changed, 36 insertions, 609 deletions
diff --git a/specs/CH09.xml b/specs/CH09.xml index 75914c1..22b02a6 100644 --- a/specs/CH09.xml +++ b/specs/CH09.xml @@ -81,7 +81,7 @@ sequence ``Xt'' are reserved to the Intrinsics for future standard and implementation-dependent uses. Widget header files typically contain a symbolic name for each resource name. All resource names, classes, and types used by the Intrinsics are named in -<function>< X11/StringDefs.h >.</function> +<function><X11/StringDefs.h>.</function> The Intrinsics's symbolic resource names begin with ``XtN'' and are followed by the string name (for example, XtNbackgroundPixel @@ -364,7 +364,7 @@ The Intrinsics define the following resource types: </informaltable> <para> -<function>< X11/StringDefs.h ></function> +<function><X11/StringDefs.h></function> also defines the following resource types as a convenience for widgets, although they do not have any corresponding data type assigned: @@ -438,7 +438,7 @@ procedure pointers are of type <funcsynopsis id='XtResourceDefaultProc'> <funcprototype> -<funcdef>void <function>*XtResourceDefaultProc</function></funcdef> +<funcdef>typedef void <function>(*XtResourceDefaultProc)</function></funcdef> <paramdef>Widget <parameter>w</parameter></paramdef> <paramdef>int <parameter>offset</parameter></paramdef> <paramdef>XrmValue *<parameter>value</parameter></paramdef> @@ -1724,7 +1724,7 @@ an input value of representation type Type converters use pointers to <function>XrmValue</function> structures (defined in -<function>< X11/Xresource.h >;</function> +<function><X11/Xresource.h>;</function> see Section 15.4 in <emphasis remap='I'>Xlib — C Language X Interface.</emphasis>) for input and output values. </para> @@ -1750,7 +1750,7 @@ A resource converter procedure pointer is of type <funcsynopsis id='XtTypeConverter'> <funcprototype> -<funcdef>Boolean <function>*XtTypeConverter</function></funcdef> +<funcdef>typedef Boolean <function>(*XtTypeConverter)</function></funcdef> <paramdef>Display *<parameter>display</parameter></paramdef> <paramdef>XrmValue *<parameter>args</parameter></paramdef> <paramdef>Cardinal *<parameter>num_args</parameter></paramdef> @@ -2471,7 +2471,7 @@ and the structure <function>XtConvertArgRec</function> specify how each argument is derived. These are defined in -<function>< X11/Intrinsic.h >.</function> +<function><X11/Intrinsic.h>.</function> </para> <literallayout class="monospaced"> typedef enum { @@ -2484,6 +2484,7 @@ typedef enum { XtWidgetBaseOffset, /* offset */ XtProcedureArg /* procedure to call */ } XtAddressMode; + typedef struct { XtAddressMode address_mode; XtPointer address_id; @@ -2598,595 +2599,6 @@ by <emphasis remap='I'>args</emphasis>. </para> </sect2> -<sect2 id='Issuing_Conversion_Warnings_2'> -<title>Issuing Conversion Warnings</title> -<para> -The -<function>XtDisplayStringConversionWarning</function> -procedure is a convenience routine for resource type converters -that convert from string values. -</para> - -<funcsynopsis id='XtDisplayStringConversionWarning_2'> -<funcprototype> -<funcdef>void <function>XtDisplayStringConversionWarning</function></funcdef> - <paramdef>Display *<parameter>display</parameter></paramdef> - <paramdef>String <parameter>from_value</parameter></paramdef> -</funcprototype> -</funcsynopsis> - -<variablelist> - <varlistentry> - <term> - <emphasis remap='I'>display</emphasis> - </term> - <listitem> - <para> -Specifies the display connection with which the conversion is associated. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>from_value</emphasis> - </term> - <listitem> - <para> -Specifies the string that could not be converted. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>to_type</emphasis> - </term> - <listitem> - <para> -Specifies the target representation type requested. - </para> - </listitem> - </varlistentry> -</variablelist> -<para> -The -<function>XtDisplayStringConversionWarning</function> -procedure issues a warning message using -<function>XtAppWarningMsg</function> -with <emphasis remap='I'>name</emphasis> ``conversionError'', -<emphasis remap='I'>type</emphasis> ``string'', <emphasis remap='I'>class</emphasis> ``XtToolkitError'', and the default message -``Cannot convert "<emphasis remap='I'>from_value</emphasis>" to type <emphasis remap='I'>to_type</emphasis>''. -</para> - -<para> -To issue other types of warning or error messages, the type converter -should use -<function>XtAppWarningMsg</function> -or -<function>XtAppErrorMsg</function>. -</para> - -<para> -To retrieve the application context associated with a given -display connection, use -<function>XtDisplayToApplicationContext</function>. -</para> - -<funcsynopsis id='XtDisplayToApplicationContext_2'> -<funcprototype> -<funcdef>XtAppContext <function>XtDisplayToApplicationContext</function></funcdef> - <paramdef>Display *<parameter>display</parameter></paramdef> -</funcprototype> -</funcsynopsis> - -<variablelist> - <varlistentry> - <term> - <emphasis remap='I'>display</emphasis> - </term> - <listitem> - <para> -Specifies an open and initialized display connection. - </para> - </listitem> - </varlistentry> -</variablelist> -<para> -The -<function>XtDisplayToApplicationContext</function> -function returns the application -context in which the specified <emphasis remap='I'>display</emphasis> was initialized. If the -display is not known to the Intrinsics, an error message is issued. -</para> -</sect2> - -<sect2 id='Registering_a_New_Resource_Converter_2'> -<title>Registering a New Resource Converter</title> -<para> -When registering a resource converter, the client must specify the -manner in which the conversion cache is to be used when there are multiple -calls to the converter. Conversion cache control is specified -via an <function>XtCacheType</function> -argument. </para> - -<literallayout class="monospaced"> -typedef int XtCacheType; -</literallayout> - -<para> -An <function>XtCacheType</function> -field may contain one of the following values: -</para> - -<para> -<function>XtCacheNone</function> -</para> -<itemizedlist> - <listitem> - <para> -Specifies that the results of a previous conversion -may not be reused to satisfy any other resource -requests; the specified converter will be called -each time the converted value is required. - </para> - </listitem> -</itemizedlist> -<para> -<function>XtCacheAll</function> -</para> -<itemizedlist> - <listitem> - <para> -Specifies that the results of a previous conversion -should be reused for any resource request that depends -upon the same source value and conversion arguments. - </para> - </listitem> -</itemizedlist> -<para> -<function>XtCacheByDisplay</function> -</para> -<itemizedlist> - <listitem> - <para> -Specifies that the results of a previous conversion -should be used as for -<function>XtCacheAll</function> -but the destructor will be called, if specified, if -<function>XtCloseDisplay</function> -is called -for the display connection associated with the converted value, and -the value will be removed from the conversion cache. - </para> - </listitem> -</itemizedlist> -<para> -The qualifier -<function>XtCacheRefCount</function> -may be ORed with any of the above values. If -<function>XtCacheRefCount</function> -is specified, calls to -<function>XtCreateWidget</function>, -<function>XtCreateManagedWidget</function>, -<function>XtGetApplicationResources</function>, -and -<function>XtGetSubresources</function> -that use the converted value will be counted. When a widget using the -converted value is destroyed, the count is decremented, and, if the -count reaches zero, the destructor procedure will be called and the -converted value will be removed from the conversion cache. -</para> - -<para> -To register a type converter for all application contexts in a -process, use -<function>XtSetTypeConverter</function>, -and to register a type converter in a single application context, use -<function>XtAppSetTypeConverter</function>. -</para> - -<funcsynopsis id='XtSetTypeConverter_2'> -<funcprototype> -<funcdef>void <function>XtSetTypeConverter</function></funcdef> - <paramdef>String <parameter>from_type</parameter></paramdef> - <paramdef>String <parameter>to_type</parameter></paramdef> - <paramdef>XtTypeConverter <parameter>converter</parameter></paramdef> - <paramdef>XtConvertArgList <parameter>convert_args</parameter></paramdef> - <paramdef>Cardinal <parameter>num_args</parameter></paramdef> - <paramdef>XtCacheType <parameter>cache_type</parameter></paramdef> - <paramdef>XtDestructor <parameter>destructor</parameter></paramdef> -</funcprototype> -</funcsynopsis> - -<variablelist> - <varlistentry> - <term> - <emphasis remap='I'>from_type</emphasis> - </term> - <listitem> - <para> -Specifies the source type. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>to_type</emphasis> - </term> - <listitem> - <para> -Specifies the destination type. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>converter</emphasis> - </term> - <listitem> - <para> -Specifies the resource type converter procedure. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>convert_args</emphasis> - </term> - <listitem> - <para> -Specifies additional conversion arguments, or NULL. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>num_args</emphasis> - </term> - <listitem> - <para> -Specifies the number of entries in <emphasis remap='I'>convert_args</emphasis>. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>cache_type</emphasis> - </term> - <listitem> - <para> -Specifies whether or not resources produced by this -converter are sharable or display-specific and when -they should be freed. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>destructor</emphasis> - </term> - <listitem> - <para> -Specifies a destroy procedure for resources produced by -this conversion, or NULL if no additional action is -required to deallocate resources produced by the converter. - </para> - </listitem> - </varlistentry> -</variablelist> - -<funcsynopsis id='XtAppSetTypeConverter_2'> -<funcprototype> -<funcdef> <function>XtAppSetTypeConverter</function></funcdef> - <paramdef>XtAppContext <parameter>app_context</parameter></paramdef> - <paramdef>String <parameter>from_type</parameter></paramdef> - <paramdef>String <parameter>to_type</parameter></paramdef> - <paramdef>XtTypeConverter <parameter>converter</parameter></paramdef> - <paramdef>XtConvertArgList <parameter>convert_args</parameter></paramdef> - <paramdef>Cardinal <parameter>num_args</parameter></paramdef> - <paramdef>XtCacheType <parameter>cache_type</parameter></paramdef> - <paramdef>XtDestructor <parameter>destructor</parameter></paramdef> -</funcprototype> -</funcsynopsis> - -<variablelist> - <varlistentry> - <term> - <emphasis remap='I'>app_context</emphasis> - </term> - <listitem> - <para> -Specifies the application context. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>from_type</emphasis> - </term> - <listitem> - <para> -Specifies the source type. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>to_type</emphasis> - </term> - <listitem> - <para> -Specifies the destination type. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>converter</emphasis> - </term> - <listitem> - <para> -Specifies the resource type converter procedure. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>convert_args</emphasis> - </term> - <listitem> - <para> -Specifies additional conversion arguments, or NULL. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>num_args</emphasis> - </term> - <listitem> - <para> -Specifies the number of entries in <emphasis remap='I'>convert_args</emphasis>. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>cache_type</emphasis> - </term> - <listitem> - <para> -Specifies whether or not resources produced by this -converter are sharable or display-specific and when -they should be freed. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>destructor</emphasis> - </term> - <listitem> - <para> -Specifies a destroy procedure for resources produced by -this conversion, or NULL if no additional action is -required to deallocate resources produced by the converter. - </para> - </listitem> - </varlistentry> -</variablelist> -<para> -<function>XtSetTypeConverter</function> -registers the specified type converter and -destructor in all application contexts created by the calling process, -including any future application contexts that may be created. -<function>XtAppSetTypeConverter</function> -registers the specified type converter in the -single application context specified. If the same <emphasis remap='I'>from_type</emphasis> and -<emphasis remap='I'>to_type</emphasis> are specified in multiple calls to either function, the most -recent overrides the previous ones. -</para> - -<para> -For the few type converters that need additional arguments, -the Intrinsics conversion mechanism provides a method of specifying -how these arguments should be computed. -The enumerated type -<function>XtAddressMode</function> -and the structure -<function>XtConvertArgRec</function> -specify how each argument is derived. -These are defined in -<function>< X11/Intrinsic.h >.</function> -</para> -<literallayout class="monospaced"> -typedef enum { - /* address mode parameter representation */ - XtAddress, /* address */ - XtBaseOffset, /* offset */ - XtImmediate, /* constant */ - XtResourceString, /* resource name string */ - XtResourceQuark, /* resource name quark */ - XtWidgetBaseOffset, /* offset */ - XtProcedureArg /* procedure to call */ -} XtAddressMode; -typedef struct { - XtAddressMode address_mode; - XtPointer address_id; - Cardinal size; -} XtConvertArgRec, *XtConvertArgList; -</literallayout> -<para> -The <emphasis remap='I'>size</emphasis> field specifies the length of the data in bytes. -The <emphasis remap='I'>address_mode</emphasis> field specifies how the <emphasis remap='I'>address_id</emphasis> field should be -interpreted. -<function>XtAddress</function> -causes <emphasis remap='I'>address_id</emphasis> to be interpreted as the address of the data. -<function>XtBaseOffset</function> -causes <emphasis remap='I'>address_id</emphasis> to be interpreted as the offset from the widget base. -<function>XtImmediate</function> -causes <emphasis remap='I'>address_id</emphasis> to be interpreted as a constant. -<function>XtResourceString</function> -causes <emphasis remap='I'>address_id</emphasis> to be interpreted as the name of a resource -that is to be converted into an offset from the widget base. -<function>XtResourceQuark</function> -causes <emphasis remap='I'>address_id</emphasis> to be interpreted as the result of an -<function>XrmStringToQuark</function> -conversion on the name of a resource, -which is to be converted into an offset from the widget base. -<function>XtWidgetBaseOffset</function> -is similar to -<function>XtBaseOffset</function> -except that it -searches for the closest windowed ancestor if the object is not -of a subclass of -Core -(see Chapter 12). -<function>XtProcedureArg</function> -specifies that <emphasis remap='I'>address_id</emphasis> is a pointer to a procedure to -be invoked to return the conversion argument. If -<function>XtProcedureArg</function> -is specified, <emphasis remap='I'>address_id</emphasis> must contain -the address of a function of type -<function>XtConvertArgProc</function>. -</para> - -<funcsynopsis id='_XtConvertArgProc'> -<funcprototype> -<funcdef>typedef void <function>(*XtConvertArgProc)</function></funcdef> - <paramdef>Widget <parameter>object</parameter></paramdef> - <paramdef>Cardinal *<parameter>size</parameter></paramdef> - <paramdef>XrmValue *<parameter>value</parameter></paramdef> -</funcprototype> -</funcsynopsis> - -<variablelist> - <varlistentry> - <term> - <emphasis remap='I'>object</emphasis> - </term> - <listitem> - <para> -Passes the object for which the resource is being -converted, or NULL if the converter was invoked by -<function>XtCallConverter</function> -or -<function>XtDirectConvert</function>. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>size</emphasis> - </term> - <listitem> - <para> -Passes a pointer to the <emphasis remap='I'>size</emphasis> field from the -<function>XtConvertArgRec</function>. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term> - <emphasis remap='I'>value</emphasis> - </term> - <listitem> - <para> -Passes a pointer to a descriptor into which the procedure -must store the conversion argument. - </para> - </listitem> - </varlistentry> -</variablelist> -<para> -When invoked, the -<function>XtConvertArgProc</function> -procedure must derive a conversion -argument and store the address and size of the argument in the location -pointed to by <emphasis remap='I'>value</emphasis>. -</para> - -<para> -In order to permit reentrancy, the -<function>XtConvertArgProc</function> -should return the address of storage whose lifetime is no shorter than the -lifetime of <emphasis remap='I'>object</emphasis>. If <emphasis remap='I'>object</emphasis> is NULL, the lifetime of the conversion -argument must be no shorter than the lifetime of the resource with -which the conversion argument is associated. The Intrinsics do not -guarantee to copy this storage but do guarantee not to reference it if -the resource is removed from the conversion cache. -</para> - -<para> -The following example illustrates how to register the CvtStringToPixel -routine given earlier: -</para> -<literallayout class="monospaced"> -static XtConvertArgRec colorConvertArgs[] = { - {XtWidgetBaseOffset, (XtPointer)XtOffset(Widget, core.screen), sizeof(Screen*)}, - {XtWidgetBaseOffset, (XtPointer)XtOffset(Widget, core.colormap),sizeof(Colormap)} -}; -XtSetTypeConverter(XtRString, XtRPixel, CvtStringToPixel, - colorConvertArgs, XtNumber(colorConvertArgs), XtCacheByDisplay, NULL); -</literallayout> -<para> -The conversion argument descriptors -<function>colorConvertArgs</function> -and -<function>screenConvertArg</function> -are predefined by the Intrinsics. Both take the -values from the closest windowed ancestor if the object is not of a -subclass of -Core. -The -<function>screenConvertArg</function> -descriptor puts the widget's <emphasis remap='I'>screen</emphasis> field into <emphasis remap='I'>args</emphasis>[0]. The -<function>colorConvertArgs</function> -descriptor puts the widget's <emphasis remap='I'>screen</emphasis> field into <emphasis remap='I'>args</emphasis>[0], -and the widget's <emphasis remap='I'>colormap</emphasis> field into <emphasis remap='I'>args</emphasis>[1]. -</para> - -<para> -Conversion routines should not just put a descriptor for the address of the -base of the widget into <emphasis remap='I'>args</emphasis>[0], and use that in the routine. -They should pass in the actual values on which the conversion depends. -By keeping the dependencies of the conversion procedure specific, -it is more likely that subsequent conversions will find what they need -in the conversion cache. -This way the cache is smaller and has fewer and more widely applicable entries. -</para> - -<para> -If any conversion arguments of type -<function>XtBaseOffset</function>, -<function>XtResourceString</function>, -<function>XtResourceQuark</function>, -and -<function>XtWidgetBaseOffset</function> -are specified for conversions performed by -<function>XtGetApplicationResources</function>, -<function>XtGetSubresources</function>, -<function>XtVaGetApplicationResources</function>, -or -<function>XtVaGetSubresources</function>, -the arguments are -computed with respect to the specified widget, not the base address or -resource list specified in the call. -</para> - -<para> -If the -<function>XtConvertArgProc</function> -modifies the resource database, -the changes affect any in-progress widget creation, -<function>XtGetApplicationResources</function>, -or -<function>XtGetSubresources</function> -in an implementation-defined manner; however, insertion of new entries -or changes to existing entries are allowed and will not directly cause -an error. -</para> -</sect2> - <sect2 id="Resource_Converter_Invocation"> <title>Resource Converter Invocation</title> <para> @@ -3753,14 +3165,18 @@ Not valid following any operation that modifies the resource: </para> </listitem> <listitem> - <para> + <itemizedlist> + <listitem> + <para> XtNchildren resource of composite widgets. - </para> - </listitem> - <listitem> - <para> + </para> + </listitem> + <listitem> + <para> All resources of representation type XtRCallback. - </para> + </para> + </listitem> + </itemizedlist> </listitem> <listitem> <para> @@ -3768,9 +3184,13 @@ Remain valid at least until the widget is destroyed: </para> </listitem> <listitem> - <para> + <itemizedlist> + <listitem> + <para> XtNaccelerators, XtNtranslations. - </para> + </para> + </listitem> + </itemizedlist> </listitem> <listitem> <para> @@ -3778,9 +3198,13 @@ Remain valid until the Display is closed: </para> </listitem> <listitem> - <para> + <itemizedlist> + <listitem> + <para> XtNscreen. - </para> + </para> + </listitem> + </itemizedlist> </listitem> </itemizedlist> <para> @@ -3842,6 +3266,7 @@ instance using varargs lists, use <funcprototype> <funcdef>void <function>XtVaGetValues</function></funcdef> <paramdef>Widget <parameter>object</parameter></paramdef> + <paramdef><parameter>...</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -3895,9 +3320,9 @@ The get_values_hook procedure pointer is of type <function>XtArgsProc</function>. </para> -<funcsynopsis id='XtArgsProc_2'> +<funcsynopsis id='XtArgsProc'> <funcprototype> -<funcdef>void <function>*XtArgsProc</function></funcdef> +<funcdef>typedef void <function>(*XtArgsProc)</function></funcdef> <paramdef>Widget <parameter>w</parameter></paramdef> <paramdef>ArgList <parameter>args</parameter></paramdef> @@ -4047,6 +3472,7 @@ a widget instance using varargs lists, use <paramdef>XtPointer <parameter>base</parameter></paramdef> <paramdef>XtResourceList <parameter>resources</parameter></paramdef> <paramdef>Cardinal <parameter>num_resources</parameter></paramdef> + <paramdef> <parameter>...</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -4253,6 +3679,7 @@ instance using varargs lists, use <funcprototype> <funcdef>void <function>XtVaSetValues</function></funcdef> <paramdef>Widget <parameter>object</parameter></paramdef> + <paramdef> <parameter>...</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -4295,7 +3722,7 @@ The set_values procedure pointer in a widget class is of type <funcsynopsis id='XtSetValuesFunc'> <funcprototype> -<funcdef>Boolean <function>*XtSetValuesFunc</function></funcdef> +<funcdef>typedef Boolean <function>(*XtSetValuesFunc)</function></funcdef> <paramdef>Widget <parameter>current</parameter></paramdef> <paramdef>Widget <parameter>request</parameter></paramdef> @@ -4490,7 +3917,7 @@ The set_values_almost procedure pointer in the widget class record is of type <funcsynopsis id='XtAlmostProc'> <funcprototype> -<funcdef>void <function>*XtAlmostProc</function></funcdef> +<funcdef>typedef void <function>(*XtAlmostProc)</function></funcdef> <paramdef>Widget <parameter>old</parameter></paramdef> <paramdef>Widget <parameter>new</parameter></paramdef> |